lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] git commit: Check micro_sym when testing method compatibility
Date Tue, 18 Mar 2014 17:27:25 GMT
Repository: lucy-clownfish
Updated Branches:
  refs/heads/single-parcel-per-file 168f3baa2 -> ba106eb22


Check micro_sym when testing method compatibility

Also fix the tests to really test for different names.


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

Branch: refs/heads/single-parcel-per-file
Commit: ba106eb228b166471935cf87cf9683e126bf565d
Parents: 168f3ba
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Tue Mar 18 18:25:58 2014 +0100
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Tue Mar 18 18:25:58 2014 +0100

----------------------------------------------------------------------
 compiler/perl/t/201-method.t | 4 ++--
 compiler/src/CFCMethod.c     | 6 ++++++
 compiler/src/CFCTestMethod.c | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ba106eb2/compiler/perl/t/201-method.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/201-method.t b/compiler/perl/t/201-method.t
index d1b232e..32b02b0 100644
--- a/compiler/perl/t/201-method.t
+++ b/compiler/perl/t/201-method.t
@@ -82,14 +82,14 @@ ok( !$method->compatible($missing_default),
 ok( !$missing_default->compatible($method), "... reversed" );
 
 my $param_name_differs = Clownfish::CFC::Model::Method->new( %args,
-    param_list => $parser->parse('(Foo *self, int32_t countess)'), );
+    param_list => $parser->parse('(Foo *self, int32_t countess = 0)'), );
 ok( !$method->compatible($param_name_differs),
     "different param name spoils compatible()"
 );
 ok( !$param_name_differs->compatible($method), "... reversed" );
 
 my $param_type_differs = Clownfish::CFC::Model::Method->new( %args,
-    param_list => $parser->parse('(Foo *self, uint32_t count)'), );
+    param_list => $parser->parse('(Foo *self, uint32_t count = 0)'), );
 ok( !$method->compatible($param_type_differs),
     "different param type spoils compatible()"
 );

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ba106eb2/compiler/src/CFCMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCMethod.c b/compiler/src/CFCMethod.c
index 8bc9e37..090b35d 100644
--- a/compiler/src/CFCMethod.c
+++ b/compiler/src/CFCMethod.c
@@ -190,6 +190,12 @@ CFCMethod_compatible(CFCMethod *self, CFCMethod *other) {
             if (!CFCType_equals(my_type, other_type)) {
                 return false;
             }
+
+            const char *my_sym    = CFCVariable_micro_sym(my_args[i]);
+            const char *other_sym = CFCVariable_micro_sym(other_args[i]);
+            if (strcmp(my_sym, other_sym) != 0) {
+                return false;
+            }
         }
         else {
             break;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ba106eb2/compiler/src/CFCTestMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestMethod.c b/compiler/src/CFCTestMethod.c
index 39dd8d3..b2eca23 100644
--- a/compiler/src/CFCTestMethod.c
+++ b/compiler/src/CFCTestMethod.c
@@ -97,7 +97,7 @@ S_run_basic_tests(CFCTest *test) {
             "(Foo *self, int32_t count = 0, int b)",
             "(Foo *self, int32_t count = 1)",
             "(Foo *self, int32_t count)",
-            "(Foo *self, int32_t countess)",
+            "(Foo *self, int32_t countess = 0)",
             "(Foo *self, uint32_t count = 0)"
         };
         static const char *test_names[5] = {


Mime
View raw message