From: Tara L Andrews Date: Tue, 11 Jun 2013 07:35:35 +0000 (+0200) Subject: let stringify_args pass all args; add test for reading dups X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e19635f8882eb91efcb037750aafdd2d70fa7394;p=scpubgit%2Fstemmatology.git let stringify_args pass all args; add test for reading dups --- diff --git a/base/lib/Text/Tradition/Collation.pm b/base/lib/Text/Tradition/Collation.pm index a47e3d1..be84609 100644 --- a/base/lib/Text/Tradition/Collation.pm +++ b/base/lib/Text/Tradition/Collation.pm @@ -487,11 +487,14 @@ is( $csucc->id, 'n136', "Found correct common successor to duped reading" ); # Check that the bad transposition is gone is( $sc->get_relationship( 'n130', 'n135' ), undef, "Bad transposition relationship is gone" ); +# The collation should not be fixed +my @pairs = $sc->identical_readings(); +is( scalar @pairs, 0, "Not re-collated yet" ); # Fix the collation ok( $sc->merge_readings( 'n124', 'n131_0' ), "Collated the readings correctly" ); -my @pairs = $sc->identical_readings( start => 'n124', end => $csucc->id ); -is( $sc->end->rank, 11, "The ranks shifted appropriately" ); +@pairs = $sc->identical_readings( start => 'n124', end => $csucc->id ); is( scalar @pairs, 3, "Found three more identical readings" ); +is( $sc->end->rank, 11, "The ranks shifted appropriately" ); $sc->flatten_ranks(); is( scalar( $sc->readings ), $numr - 3, "Now we are collated correctly" ); @@ -696,8 +699,8 @@ around qw/ get_relationship del_relationship / => sub { if( @args == 1 && ref( $args[0] ) eq 'ARRAY' ) { @args = @{$_[0]}; } - my( $source, $target ) = $self->_stringify_args( @args ); - $self->$orig( $source, $target ); + my @stringargs = $self->_stringify_args( @args ); + $self->$orig( @stringargs ); }; =head2 reading_witnesses( $reading ) @@ -1816,7 +1819,6 @@ graph, specified either by node or by rank. sub identical_readings { my ( $self, %args ) = @_; # Find where we should start and end. - $DB::single = 1; my $startrank = $args{startrank} || 0; if( $args{start} ) { throw( "Starting reading has no rank" ) unless $self->reading( $args{start} ) diff --git a/base/t/text_tradition_collation.t b/base/t/text_tradition_collation.t index efabb63..631ac89 100644 --- a/base/t/text_tradition_collation.t +++ b/base/t/text_tradition_collation.t @@ -77,11 +77,14 @@ is( $csucc->id, 'n136', "Found correct common successor to duped reading" ); # Check that the bad transposition is gone is( $sc->get_relationship( 'n130', 'n135' ), undef, "Bad transposition relationship is gone" ); +# The collation should not be fixed +my @pairs = $sc->identical_readings(); +is( scalar @pairs, 0, "Not re-collated yet" ); # Fix the collation ok( $sc->merge_readings( 'n124', 'n131_0' ), "Collated the readings correctly" ); -my @pairs = $sc->identical_readings( start => 'n124', end => $csucc->id ); -is( $sc->end->rank, 11, "The ranks shifted appropriately" ); +@pairs = $sc->identical_readings( start => 'n124', end => $csucc->id ); is( scalar @pairs, 3, "Found three more identical readings" ); +is( $sc->end->rank, 11, "The ranks shifted appropriately" ); $sc->flatten_ranks(); is( scalar( $sc->readings ), $numr - 3, "Now we are collated correctly" ); }