9 plan skip_all => "Flemm 3.1 required" if $@;
11 binmode( STDOUT, ':utf8' );
12 binmode( STDERR, ':utf8' );
14 my $tf = Text::Tradition->new(
16 'file' => 't/data/besoin.xml',
17 'language' => 'French' );
20 my $graphmlstr = $tf->collation->as_graphml;
21 like( $graphmlstr, qr/graphml xmlns/,
22 "Serialized tradition after lemmatization" );
23 like( $graphmlstr, qr/lexemes/, "Serialization contains lexeme info" );
25 my $tf2 = Text::Tradition->new(
27 string => $graphmlstr,
28 language => 'French' );
30 ok( $tf2->$_isa('Text::Tradition'), "Re-parsed tradition with lemmatization" );
31 is( $tf->name, $tf2->name, "Traditions have same name" );
32 foreach my $r ( $tf->collation->readings ) {
33 my $r2 = $tf2->collation->reading( $r->id );
34 ok( $r2->$_isa('Text::Tradition::Collation::Reading'),
35 "Reading $r exists in new tradition" );
37 is( scalar $r->lexemes, scalar $r2->lexemes,
38 "Same number of lexemes in new tradition for $r" );
42 # Test a snippet of tradition with possibly-problematic saved lexemes
43 my $tf3 = Text::Tradition->new(
45 'file' => 't/data/lexformat.xml' );
46 ok( $tf3->$_isa('Text::Tradition'),
47 "Successfully parsed tradition with incomplete lexemes" );