4 use Test::More 'no_plan';
12 binmode STDOUT, ":utf8";
13 binmode STDERR, ":utf8";
14 eval { no warnings; binmode $DB::OUT, ":utf8"; };
16 use_ok( 'Text::Tradition::Parser::JSON' );
18 open( JSFILE, 't/data/cx16.json' );
19 binmode JSFILE, ':utf8';
23 my $t = Text::Tradition->new(
26 'string' => join( '', @lines ),
29 is( ref( $t ), 'Text::Tradition', "Parsed a JSON alignment" );
31 is( scalar $t->collation->readings, 26, "Collation has all readings" );
32 is( scalar $t->collation->paths, 32, "Collation has all paths" );
33 is( scalar $t->witnesses, 3, "Collation has all witnesses" );
37 map { $seen_wits{$_} = 0 } qw/ A B C /;
38 # Check that we have the right witnesses
39 foreach my $wit ( $t->witnesses ) {
40 $seen_wits{$wit->sigil} = 1;
42 is( scalar keys %seen_wits, 3, "No extra witnesses were made" );
43 foreach my $k ( keys %seen_wits ) {
44 ok( $seen_wits{$k}, "Witness $k still exists" );
47 # Check that the witnesses have the right texts
48 foreach my $wit ( $t->witnesses ) {
49 my $origtext = join( ' ', @{$wit->text} );
50 my $graphtext = $t->collation->path_text( $wit->sigil );
51 is( $graphtext, $origtext, "Collation matches original for witness " . $wit->sigil );