X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=analysis%2Ft%2Ftext_tradition_stemma.t;h=7995db409f5b65aa2033b8e79ef6a325bb5a9d69;hb=11954259de7d1fd546e79098b2ec091e6e8a8fda;hp=3650076aef2a60f8d91b0b9b339f5acf4b422c5d;hpb=a47b32d9615d1037bc0f3dccbb733daddcfa63a3;p=scpubgit%2Fstemmatology.git diff --git a/analysis/t/text_tradition_stemma.t b/analysis/t/text_tradition_stemma.t index 3650076..7995db4 100644 --- a/analysis/t/text_tradition_stemma.t +++ b/analysis/t/text_tradition_stemma.t @@ -13,20 +13,15 @@ use TryCatch; use_ok( 'Text::Tradition::Stemma' ); # Try to create a bad graph -my $baddotfh; -open( $baddotfh, 't/data/besoin_bad.dot' ) or die "Could not open test dotfile"; try { - my $stemma = Text::Tradition::Stemma->new( dot => $baddotfh ); + my $stemma = Text::Tradition::Stemma->new( dotfile => 't/data/besoin_bad.dot' ); ok( 0, "Created broken stemma from dotfile with syntax error" ); } catch( Text::Tradition::Error $e ) { like( $e->message, qr/^Error trying to parse/, "Syntax error in dot threw exception" ); } # Create a good graph -my $dotfh; -open( $dotfh, 't/data/florilegium.dot' ) or die "Could not open test dotfile"; -binmode( $dotfh, ':utf8' ); -my $stemma = Text::Tradition::Stemma->new( dot => $dotfh ); +my $stemma = Text::Tradition::Stemma->new( dotfile => 't/data/florilegium.dot' ); is( ref( $stemma ), 'Text::Tradition::Stemma', "Created stemma from good dotfile" ); is( scalar $stemma->witnesses, 13, "Found correct number of extant witnesses" ); is( scalar $stemma->hypotheticals, 8, "Found correct number of extant hypotheticals" ); @@ -39,14 +34,12 @@ foreach my $h ( $stemma->hypotheticals ) { ok( $found_unicode_sigil, "Found a correctly encoded Unicode sigil" ); # Create an undirected graph -my $undirdotfh; -open( $undirdotfh, 't/data/besoin_undirected.dot' ) or die "Could not open test dotfile"; -binmode( $undirdotfh, ':utf8' ); -my $udstemma = Text::Tradition::Stemma->new( dot => $undirdotfh ); +my $udstemma = Text::Tradition::Stemma->new( dotfile => 't/data/besoin_undirected.dot' ); is( ref( $udstemma ), 'Text::Tradition::Stemma', "Created stemma from undirected dotfile" ); is( scalar $udstemma->witnesses, 13, "Found correct number of extant witnesses" ); is( scalar $udstemma->hypotheticals, 12, "Found correct number of hypotheticals" ); ok( $udstemma->is_undirected, "Stemma was recorded as undirected" ); +is( $udstemma->identifier, "RHM stemma", "Undirected graph retained its name" ); }