You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2015/05/12 16:14:30 UTC

[2/7] lucy-clownfish git commit: Change test to subclass Obj rather than Hash.

Change test to subclass Obj rather than Hash.

Hash is about to become final, so we need to subclass a class which will
remain extensible: Obj.


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

Branch: refs/heads/master
Commit: 88895811c67745db71926895dfeea97931a474de
Parents: 7c1dc69
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Fri May 8 19:04:07 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon May 11 17:22:25 2015 -0700

----------------------------------------------------------------------
 runtime/perl/t/021-class.t | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/88895811/runtime/perl/t/021-class.t
----------------------------------------------------------------------
diff --git a/runtime/perl/t/021-class.t b/runtime/perl/t/021-class.t
index 61feec2..2a87d5d 100644
--- a/runtime/perl/t/021-class.t
+++ b/runtime/perl/t/021-class.t
@@ -16,8 +16,8 @@
 use strict;
 use warnings;
 
-package MyHash;
-use base qw( Clownfish::Hash );
+package MyObj;
+use base qw( Clownfish::Obj );
 
 sub oodle { }
 
@@ -29,29 +29,26 @@ my $stringified;
 my $storage = Clownfish::Hash->new;
 
 {
-    my $subclassed_hash = MyHash->new;
-    $stringified = $subclassed_hash->to_string;
+    my $subclassed_obj = MyObj->new;
+    $stringified = $subclassed_obj->to_string;
 
-    isa_ok( $subclassed_hash, "MyHash", "Perl isa reports correct subclass" );
+    isa_ok( $subclassed_obj, "MyObj", "Perl isa reports correct subclass" );
 
    # Store the subclassed object.  At the end of this block, the Perl object
    # will go out of scope and DESTROY will be called, but the Clownfish object
    # will persist.
-    $storage->store( "test", $subclassed_hash );
+    $storage->store( "test", $subclassed_obj );
 }
 
 my $resurrected = $storage->_fetch("test");
 
-isa_ok( $resurrected, "MyHash", "subclass name survived Perl destruction" );
+isa_ok( $resurrected, "MyObj", "subclass name survived Perl destruction" );
 is( $resurrected->to_string, $stringified,
     "It's the same Hash from earlier (though a different Perl object)" );
 
-my $booga = Clownfish::String->new("booga");
-$resurrected->store( "ooga", $booga );
+is( $resurrected->get_class_name,
+    "MyObj", "subclassed object still performs correctly at the C level" );
 
-is( $resurrected->fetch("ooga"),
-    "booga", "subclassed object still performs correctly at the C level" );
-
-my $methods = Clownfish::Class::_fresh_host_methods('MyHash');
+my $methods = Clownfish::Class::_fresh_host_methods('MyObj');
 is_deeply( $methods->to_perl, ['oodle'], "fresh_host_methods" );