From: Tara L Andrews Date: Mon, 26 Dec 2011 11:18:10 +0000 (+0100) Subject: sort-of-fix some tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7035e3a6ff8829ec8390fdfde75f23def2ed9313;p=scpubgit%2Fstemmatology.git sort-of-fix some tests --- diff --git a/lib/Text/Tradition/Collation.pm b/lib/Text/Tradition/Collation.pm index 50903a2..3214cdc 100644 --- a/lib/Text/Tradition/Collation.pm +++ b/lib/Text/Tradition/Collation.pm @@ -316,9 +316,9 @@ sub related_readings { if( ref( $reading ) eq 'Text::Tradition::Collation::Reading' ) { $reading = $reading->id; $return_object = 1; - print STDERR "Returning related objects\n"; - } else { - print STDERR "Returning related object names\n"; +# print STDERR "Returning related objects\n"; +# } else { +# print STDERR "Returning related object names\n"; } my @related = $self->relations->all_reachable( $reading ); if( $colocated ) { diff --git a/t/graph.t b/t/graph.t index ff6f0e7..bdfcdbc 100644 --- a/t/graph.t +++ b/t/graph.t @@ -9,10 +9,11 @@ use XML::LibXML::XPathContext; my $datafile = 't/data/Collatex-16.xml'; -open( GRAPHFILE, $datafile ) or die "Could not open $datafile"; -my @lines = ; -close GRAPHFILE; -my $tradition = Text::Tradition->new( 'CollateX' => join( '', @lines ) ); +my $tradition = Text::Tradition->new( + 'name' => 'inline', + 'input' => 'CollateX', + 'file' => $datafile, + ); my $collation = $tradition->collation; # Test the svg creation @@ -62,7 +63,7 @@ sub make_text { my @words; foreach my $n ( @_ ) { if( $n->[1] ) { - push( @words, $collation->reading( $n->[0] )->label ); + push( @words, $collation->reading( $n->[0] )->text ); } elsif ( !defined $n->[1] ) { push( @words, '...' ); } diff --git a/t/stemma.t b/t/stemma.t index 919f5a6..276e736 100644 --- a/t/stemma.t +++ b/t/stemma.t @@ -10,12 +10,12 @@ use XML::LibXML::XPathContext; my $datafile = 't/data/Collatex-16.xml'; #TODO need other test data -open( GRAPHFILE, $datafile ) or die "Could not open $datafile"; -my @lines = ; -close GRAPHFILE; -my $tradition = Text::Tradition->new( 'CollateX' => join( '', @lines ), - 'linear' => 1 ); -my $stemma = Text::Tradition::Stemma->new( 'tradition' => $tradition ); +my $tradition = Text::Tradition->new( + 'name' => 'inline', + 'input' => 'CollateX', + 'file' => $datafile, + ); +my $stemma = Text::Tradition::Stemma->new( 'collation' => $tradition->collation ); # Test for object creation ok( $stemma->isa( 'Text::Tradition::Stemma' ), 'Got the right sort of object' ); @@ -26,10 +26,12 @@ $stemma->make_character_matrix(); ## check number of columns # Test that pars runs -my( $status, $tree ) = $stemma->run_pars(); +my( $status, $tree ) = $stemma->run_phylip_pars(); ok( $status, "pars ran successfully" ); print STDERR "Error was $tree\n" unless $status; # Test that we get a tree # Test that the tree has all our witnesses + +done_testing(); \ No newline at end of file