X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Ftext_tradition_parser_json.t;h=0de048825e7252c622f500714dd3916d0bedeace;hb=ab06f3edf9045dc9a24ee138df7ae0b9bb141098;hp=658c58550cd2c3f7fe1b55e8b72e08173d91f7cc;hpb=a731e73a29eb1faeee2db782961c8ebe1f67239f;p=scpubgit%2Fstemmatology.git diff --git a/t/text_tradition_parser_json.t b/t/text_tradition_parser_json.t index 658c585..0de0488 100644 --- a/t/text_tradition_parser_json.t +++ b/t/text_tradition_parser_json.t @@ -32,6 +32,24 @@ if( $t ) { is( scalar $t->collation->paths, 32, "Collation has all paths" ); is( scalar $t->witnesses, 3, "Collation has all witnesses" ); } + +my %seen_wits; +map { $seen_wits{$_} = 0 } qw/ A B C /; +# Check that we have the right witnesses +foreach my $wit ( $t->witnesses ) { + $seen_wits{$wit->sigil} = 1; +} +is( scalar keys %seen_wits, 3, "No extra witnesses were made" ); +foreach my $k ( keys %seen_wits ) { + ok( $seen_wits{$k}, "Witness $k still exists" ); +} + +# Check that the witnesses have the right texts +foreach my $wit ( $t->witnesses ) { + my $origtext = join( ' ', @{$wit->text} ); + my $graphtext = $t->collation->path_text( $wit->sigil ); + is( $graphtext, $origtext, "Collation matches original for witness " . $wit->sigil ); +} }