You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2015/12/01 17:10:08 UTC

[2/6] lucy-clownfish git commit: Merge some test classes into TestHost

Merge some test classes into TestHost


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/3520bdf2
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/3520bdf2
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/3520bdf2

Branch: refs/heads/master
Commit: 3520bdf29cc176d754300d9ca527fcc90fdd4067
Parents: 508c6ab
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Dec 1 14:41:18 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Dec 1 16:06:03 2015 +0100

----------------------------------------------------------------------
 runtime/core/Clownfish/Test/TestHost.c          | 18 +++++++++++++++++
 runtime/core/Clownfish/Test/TestHost.cfh        | 16 +++++++++++++++
 runtime/core/Clownfish/Test/TestObj.c           | 21 --------------------
 runtime/core/Clownfish/Test/TestObj.cfh         | 18 -----------------
 .../perl/buildlib/Clownfish/Build/Binding.pm    |  9 ---------
 runtime/perl/t/binding/019-obj.t                | 10 +++++-----
 6 files changed, 39 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/3520bdf2/runtime/core/Clownfish/Test/TestHost.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestHost.c b/runtime/core/Clownfish/Test/TestHost.c
index 9172c99..6da0efa 100644
--- a/runtime/core/Clownfish/Test/TestHost.c
+++ b/runtime/core/Clownfish/Test/TestHost.c
@@ -19,6 +19,7 @@
 
 #include "Clownfish/Test/TestHost.h"
 #include "Clownfish/Class.h"
+#include "Clownfish/String.h"
 
 TestHost*
 TestHost_new() {
@@ -104,4 +105,21 @@ TestHost_Test_Bool_Label_Arg_Def_IMP(TestHost *self, bool arg, bool unused) {
     return arg;
 }
 
+void
+TestHost_Invoke_Invalid_Callback_From_C_IMP(TestHost *self) {
+    TestHost_Invalid_Callback(self);
+}
+
+String*
+TestHost_Aliased_IMP(TestHost *self) {
+    UNUSED_VAR(self);
+    return Str_newf("C");
+}
+
+String*
+TestHost_Invoke_Aliased_From_C_IMP(TestHost *self) {
+    UNUSED_VAR(self);
+    return TestHost_Aliased(self);
+}
+
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/3520bdf2/runtime/core/Clownfish/Test/TestHost.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestHost.cfh b/runtime/core/Clownfish/Test/TestHost.cfh
index 497c93d..92bc272 100644
--- a/runtime/core/Clownfish/Test/TestHost.cfh
+++ b/runtime/core/Clownfish/Test/TestHost.cfh
@@ -60,6 +60,22 @@ class Clownfish::Test::TestHost {
     bool
     Test_Bool_Label_Arg_Def(TestHost *self, bool arg = true,
                             bool unused = false);
+
+    /** A method that can't be overridden from the host language.
+     */
+    abstract void*
+    Invalid_Callback(TestHost *self);
+
+    void
+    Invoke_Invalid_Callback_From_C(TestHost *self);
+
+    /** A method with a custom host language alias.
+     */
+    incremented String*
+    Aliased(TestHost *self);
+
+    incremented String*
+    Invoke_Aliased_From_C(TestHost* self);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/3520bdf2/runtime/core/Clownfish/Test/TestObj.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestObj.c b/runtime/core/Clownfish/Test/TestObj.c
index 6f9b695..7d24b80 100644
--- a/runtime/core/Clownfish/Test/TestObj.c
+++ b/runtime/core/Clownfish/Test/TestObj.c
@@ -149,24 +149,3 @@ TestObj_Run_IMP(TestObj *self, TestBatchRunner *runner) {
     test_abstract_routines(runner);
 }
 
-/*********************************************************************/
-
-void
-CallbackTestObj_Invoke_Callback_IMP(CallbackTestObj *self) {
-    CallbackTestObj_Invalid_Callback(self);
-}
-
-/*********************************************************************/
-
-String*
-AliasTestObj_Aliased_IMP(AliasTestObj *self) {
-    UNUSED_VAR(self);
-    return Str_newf("C");
-}
-
-String*
-AliasTestObj_Call_Aliased_From_C_IMP(AliasTestObj *self) {
-    UNUSED_VAR(self);
-    return AliasTestObj_Aliased(self);
-}
-

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/3520bdf2/runtime/core/Clownfish/Test/TestObj.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestObj.cfh b/runtime/core/Clownfish/Test/TestObj.cfh
index 885ad7f..c5cc401 100644
--- a/runtime/core/Clownfish/Test/TestObj.cfh
+++ b/runtime/core/Clownfish/Test/TestObj.cfh
@@ -26,21 +26,3 @@ class Clownfish::Test::TestObj
     Run(TestObj *self, TestBatchRunner *runner);
 }
 
-class Clownfish::Test::CallbackTestObj {
-    /** A method that can't be overridden from the host language.
-     */
-    abstract void*
-    Invalid_Callback(CallbackTestObj *self);
-
-    void
-    Invoke_Callback(CallbackTestObj *self);
-}
-
-class Clownfish::Test::AliasTestObj {
-    incremented String*
-    Aliased(AliasTestObj *self);
-
-    incremented String*
-    Call_Aliased_From_C(AliasTestObj* self);
-}
-

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/3520bdf2/runtime/perl/buildlib/Clownfish/Build/Binding.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/buildlib/Clownfish/Build/Binding.pm b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
index d678ade..1198f5a 100644
--- a/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -24,7 +24,6 @@ sub bind_all {
     $class->bind_clownfish;
     $class->bind_test;
     $class->bind_test_host;
-    $class->bind_test_alias_obj;
     $class->bind_blob;
     $class->bind_boolean;
     $class->bind_bytebuf;
@@ -111,14 +110,6 @@ sub bind_test_host {
         parcel     => "TestClownfish",
         class_name => "Clownfish::Test::TestHost",
     );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_test_alias_obj {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "TestClownfish",
-        class_name => "Clownfish::Test::AliasTestObj",
-    );
     $binding->bind_method(
         alias  => 'perl_alias',
         method => 'Aliased',

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/3520bdf2/runtime/perl/t/binding/019-obj.t
----------------------------------------------------------------------
diff --git a/runtime/perl/t/binding/019-obj.t b/runtime/perl/t/binding/019-obj.t
index 7d71149..28efe88 100644
--- a/runtime/perl/t/binding/019-obj.t
+++ b/runtime/perl/t/binding/019-obj.t
@@ -46,13 +46,13 @@ use base qw( Clownfish::Obj );
 }
 
 package InvalidCallbackTestObj;
-use base qw( Clownfish::Test::CallbackTestObj );
+use base qw( Clownfish::Test::TestHost );
 {
     sub invalid_callback {}
 }
 
 package OverriddenAliasTestObj;
-use base qw( Clownfish::Test::AliasTestObj );
+use base qw( Clownfish::Test::TestHost );
 {
     sub perl_alias {"Perl"}
 }
@@ -141,18 +141,18 @@ SKIP: {
     like( $@, qr/NULL/,
         "Don't allow methods without nullable return values to return NULL" );
 
-    eval { InvalidCallbackTestObj->new->invoke_callback; };
+    eval { InvalidCallbackTestObj->new->invoke_invalid_callback_from_c; };
     like( $@, qr/Can't override invalid_callback via binding/ );
 }
 
-my $alias_test = Clownfish::Test::AliasTestObj->new;
+my $alias_test = Clownfish::Test::TestHost->new;
 is( $alias_test->perl_alias, 'C', "Host method aliases work" );
 
 eval { $alias_test->aliased; };
 like( $@, qr/aliased/, "Original method can't be called" );
 
 my $overridden_alias_test = OverriddenAliasTestObj->new;
-is( $overridden_alias_test->call_aliased_from_c, 'Perl',
+is( $overridden_alias_test->invoke_aliased_from_c, 'Perl',
     'Overriding aliased methods works' );
 
 eval { SubclassFinalTestObj->new; };