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 2014/07/04 23:11:15 UTC
[10/10] git commit: refs/heads/master - Remove test for VTable.
Remove test for VTable.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/0a3bccb4
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/0a3bccb4
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/0a3bccb4
Branch: refs/heads/master
Commit: 0a3bccb42afb872738db289595c9541dd06e2328
Parents: 3ffd940
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Wed Jul 2 19:28:56 2014 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Fri Jul 4 14:10:07 2014 -0700
----------------------------------------------------------------------
perl/t/021-vtable.t | 95 ------------------------------------------------
1 file changed, 95 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/0a3bccb4/perl/t/021-vtable.t
----------------------------------------------------------------------
diff --git a/perl/t/021-vtable.t b/perl/t/021-vtable.t
deleted file mode 100644
index 5141e7f..0000000
--- a/perl/t/021-vtable.t
+++ /dev/null
@@ -1,95 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-use strict;
-use warnings;
-
-package MyHash;
-use base qw( Clownfish::Hash );
-
-sub oodle { }
-
-package RAMFolderOfDeath;
-use base qw( Lucy::Store::RAMFolder );
-
-sub open_in {
- my ( $self, $filename ) = @_;
- die "Sweet, sweet death.";
-}
-
-package OnceRemoved;
-use base qw( Lucy::Search::Query );
-
-our $serialize_was_called = 0;
-sub serialize {
- my ( $self, $outstream ) = @_;
- $serialize_was_called++;
- $self->SUPER::serialize($outstream);
-}
-
-package TwiceRemoved;
-use base qw( OnceRemoved );
-
-package main;
-
-use Lucy::Test;
-use Test::More tests => 9;
-use Storable qw( nfreeze );
-
-{
- my $twice_removed = TwiceRemoved->new;
- # This triggers a call to Obj_Serialize() via the VTable dispatch.
- my $frozen = nfreeze($twice_removed);
- ok( $serialize_was_called,
- "Overridden method in intermediate class recognized" );
- my $vtable = $twice_removed->get_vtable;
- is( $vtable->get_name, "TwiceRemoved", "correct class" );
- my $parent_vtable = $vtable->get_parent;
- is( $parent_vtable->get_name, "OnceRemoved", "correct parent class" )
-}
-
-my $stringified;
-my $storage = Clownfish::Hash->new;
-
-{
- my $subclassed_hash = MyHash->new;
- $stringified = $subclassed_hash->to_string;
-
- isa_ok( $subclassed_hash, "MyHash", "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 );
-}
-
-my $resurrected = $storage->_fetch("test");
-
-isa_ok( $resurrected, "MyHash", "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->fetch("ooga"),
- "booga", "subclassed object still performs correctly at the C level" );
-
-my $methods = Clownfish::VTable::_fresh_host_methods('MyHash');
-is_deeply( $methods->to_perl, ['oodle'], "fresh_host_methods" );
-
-my $folder = RAMFolderOfDeath->new;
-eval { $folder->slurp_file('foo') }; # calls open_in, which dies per above.
-like( $@, qr/sweet/i, "override vtable method with pure perl method" );