4 use Test::More 'no_plan';
13 use_ok( 'Text::Tradition::Stemma' );
15 # Try to create a bad graph
17 local $TODO = "cannot use stdout redirection trick with FastCGI";
19 open( $baddotfh, 't/data/besoin_bad.dot' ) or die "Could not open test dotfile";
21 my $stemma = Text::Tradition::Stemma->new( dot => $baddotfh );
22 ok( 0, "Created broken stemma from dotfile with syntax error" );
23 } catch( Text::Tradition::Error $e ) {
24 like( $e->message, qr/^Error trying to parse/, "Syntax error in dot threw exception" );
30 open( $dotfh, 't/data/florilegium.dot' ) or die "Could not open test dotfile";
31 binmode( $dotfh, ':utf8' );
32 my $stemma = Text::Tradition::Stemma->new( dot => $dotfh );
33 is( ref( $stemma ), 'Text::Tradition::Stemma', "Created stemma from good dotfile" );
34 is( scalar $stemma->witnesses, 13, "Found correct number of extant witnesses" );
35 is( scalar $stemma->hypotheticals, 8, "Found correct number of extant hypotheticals" );
36 ok( $stemma->has_identifier, "Stemma identifier was found in dot" );
37 is( $stemma->identifier, 'Coislinianum lineage', "Correct stemma identifier was found in dot" );
38 my $found_unicode_sigil;
39 foreach my $h ( $stemma->hypotheticals ) {
40 $found_unicode_sigil = 1 if $h eq "\x{3b1}";
42 ok( $found_unicode_sigil, "Found a correctly encoded Unicode sigil" );
44 # TODO Create stemma from graph, create stemma from undirected graph,
45 # create stemma from incompletely-specified graph