Replace refcount method call for test-only func.

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

Branch: refs/heads/master
Commit: d08401b74d5420292a356f7a34ca69e51111537f
Parents: a1155b3
Author: Marvin Humphrey <[email protected]>
Authored: Sat Feb 7 09:55:54 2015 -0800
Committer: Marvin Humphrey <[email protected]>
Committed: Sat Feb 7 09:56:33 2015 -0800

----------------------------------------------------------------------
 runtime/perl/buildlib/Clownfish/Build/Binding.pm |  7 +++++++
 runtime/perl/t/binding/019-obj.t                 | 11 ++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/d08401b7/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 049945c..232e223 100644
--- a/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -110,6 +110,13 @@ PPCODE:
     cfish_Obj *obj = XSBind_sv_to_cfish_obj(sv, CFISH_OBJ, NULL);
     cfish_String *str = CFISH_Obj_To_String(obj);
     CFISH_DECREF(str);
+
+int
+refcount(obj)
+    cfish_Obj *obj;
+CODE:
+    RETVAL = (int)CFISH_REFCOUNT_NN(obj);
+OUTPUT: RETVAL
 END_XS_CODE
 
     my $binding = Clownfish::CFC::Binding::Perl::Class->new(

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/d08401b7/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 83134d9..0b4e80d 100644
--- a/runtime/perl/t/binding/019-obj.t
+++ b/runtime/perl/t/binding/019-obj.t
@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 22;
+use Test::More tests => 21;
 
 package TestObj;
 use base qw( Clownfish::Obj );
@@ -102,15 +102,16 @@ my $stringified_perl_obj = "$object";
 require Clownfish::Hash;
 my $hash = Clownfish::Hash->new;
 $hash->store( foo => $object );
-is( $object->get_refcount, 2, "refcount increased via C code" );
-is( $object->get_refcount, 2, "refcount increased via C code" );
+is( Clownfish::Test::refcount($object), 2, "refcount increased via C code" );
 undef $object;
 $object = $hash->fetch("foo");
 is( "$object", $stringified_perl_obj, "same perl object as before" );
 
-is( $object->get_refcount, 2, "correct refcount after retrieval" );
+is( Clownfish::Test::refcount($object),
+    2, "correct refcount after retrieval" );
 undef $hash;
-is( $object->get_refcount, 1, "correct refcount after destruction of ref" );
+is( Clownfish::Test::refcount($object),
+    1, "correct refcount after destruction of ref" );
 
 $object = SonOfTestObj->new;
 like( $object->to_string, qr/STRING:.*?SonOfTestObj/,

Reply via email to