X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Ftext_tradition_collation.t;h=fc7abe1202aaca30e38c7c3236dc3395651c6bb1;hb=9fef629bd3a741a6d74d130f10056898d504fb47;hp=8c29c020418b240a6fec082abd5ec1ba5d5d6b80;hpb=679f17e1a60a81370df8cbb49b94a2b5d19e3a98;p=scpubgit%2Fstemmatology.git diff --git a/t/text_tradition_collation.t b/t/text_tradition_collation.t index 8c29c02..fc7abe1 100644 --- a/t/text_tradition_collation.t +++ b/t/text_tradition_collation.t @@ -84,6 +84,23 @@ my $st = Text::Tradition->new( 'input' => 'Self', 'string' => $graphml ); is( scalar $st->collation->readings, $READINGS, "Reparsed collation has all readings" ); is( scalar $st->collation->paths, $PATHS, "Reparsed collation has all paths" ); is( scalar $st->collation->relationships, 3, "Reparsed collation has new relationships" ); + +# Now add a stemma, write to GraphML, and look at the output. +my $stemma = $tradition->add_stemma( 'dotfile' => 't/data/florilegium.dot' ); +is( ref( $stemma ), 'Text::Tradition::Stemma', "Parsed dotfile into stemma" ); +is( $tradition->stemmata, 1, "Tradition now has the stemma" ); +$graphml = $c->as_graphml; +like( $graphml, qr/digraph/, "Digraph declaration exists in GraphML" ); + +# Now add a user, write to GraphML, and look at the output. +unlike( $graphml, qr/testuser/, "Test user name does not exist in GraphML yet" ); +my $testuser = Text::Tradition::User->new( + id => 'testuser', password => 'testpass' ); +is( ref( $testuser ), 'Text::Tradition::User', "Created test user object" ); +$testuser->add_tradition( $tradition ); +is( $tradition->user->id, $testuser->id, "Tradition assigned to test user" ); +$graphml = $c->as_graphml; +like( $graphml, qr/testuser/, "Test user name now exists in GraphML" ); } @@ -149,12 +166,12 @@ my $c = $t->collation; is( $c->common_predecessor( 'n24', 'n23' )->id, 'n20', "Found correct common predecessor" ); is( $c->common_successor( 'n24', 'n23' )->id, - '#END#', "Found correct common successor" ); + '__END__', "Found correct common successor" ); is( $c->common_predecessor( 'n19', 'n17' )->id, 'n16', "Found correct common predecessor for readings on same path" ); is( $c->common_successor( 'n21', 'n10' )->id, - '#END#', "Found correct common successor for readings on same path" ); + '__END__', "Found correct common successor for readings on same path" ); }