add JSON alignment table parsing
[scpubgit/stemmatology.git] / t / text_tradition_parser_json.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use Test::More 'no_plan';
5 $| = 1;
6
7
8
9 # =begin testing
10 {
11 use Text::Tradition;
12 binmode STDOUT, ":utf8";
13 binmode STDERR, ":utf8";
14 eval { no warnings; binmode $DB::OUT, ":utf8"; };
15
16 use_ok( 'Text::Tradition::Parser::JSON' );
17
18 open( JSFILE, 't/data/cx16.json' );
19 binmode JSFILE, ':utf8';
20 my @lines = <JSFILE>;
21 close JSFILE;
22
23 my $t = Text::Tradition->new(
24     'name' => 'json',
25     'input' => 'JSON',
26     'string' => join( '', @lines ),
27 );
28
29 is( ref( $t ), 'Text::Tradition', "Parsed a JSON alignment" );
30 if( $t ) {
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" );
34 }
35 }
36
37
38
39
40 1;