From: Tara L Andrews Date: Sun, 22 Jan 2012 00:47:03 +0000 (+0100) Subject: allow stemma dot to be file or string X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9ba651b9a7717e06b04d524277307df39bcfd8e8;p=scpubgit%2Fstemmatology.git allow stemma dot to be file or string --- diff --git a/lib/Text/Tradition.pm b/lib/Text/Tradition.pm index f0edbbe..7995d05 100644 --- a/lib/Text/Tradition.pm +++ b/lib/Text/Tradition.pm @@ -302,7 +302,7 @@ my $t = Text::Tradition->new( ); my $s; -ok( $s = $t->add_stemma( 't/data/simple.dot' ), "Added a simple stemma" ); +ok( $s = $t->add_stemma( dotfile => 't/data/simple.dot' ), "Added a simple stemma" ); is( ref( $s ), 'Text::Tradition::Stemma', "Got a stemma object returned" ); is( $t->stemma, $s, "Stemma is the right one" ); diff --git a/lib/Text/Tradition/Directory.pm b/lib/Text/Tradition/Directory.pm index 0f7da99..7f97648 100644 --- a/lib/Text/Tradition/Directory.pm +++ b/lib/Text/Tradition/Directory.pm @@ -23,7 +23,7 @@ Text::Tradition::Directory - a KiokuDB interface for storing and retrieving trad ); my $tradition = Text::Tradition->new( @args ); - my $stemma = $tradition->add_stemma( $dotfile ); + my $stemma = $tradition->add_stemma( dotfile => $dotfile ); $d->save_tradition( $tradition ); foreach my $id ( $d->traditions ) { @@ -79,7 +79,7 @@ my $t = Text::Tradition->new( $uuid = $d->save( $t ); ok( $uuid, "Saved test tradition" ); - my $s = $t->add_stemma( 't/data/simple.dot' ); + my $s = $t->add_stemma( dotfile => 't/data/simple.dot' ); ok( $d->save( $t ), "Updated tradition with stemma" ); is( $d->tradition( $uuid ), $t, "Correct tradition returned for id" ); is( $d->tradition( $uuid )->stemma, $s, "...and it has the correct stemma" ); diff --git a/t/stemma.t b/t/stemma.t index 8d2fd6e..741fbad 100644 --- a/t/stemma.t +++ b/t/stemma.t @@ -23,7 +23,7 @@ $c->add_relationship( 'n9', 'n23', { 'type' => 'spelling' } ); $c->add_relationship( 'n8', 'n13', { 'type' => 'spelling' } ); $c->calculate_ranks(); -my $stemma = $tradition->add_stemma( 't/data/simple.dot' ); +my $stemma = $tradition->add_stemma( dotfile => 't/data/simple.dot' ); # Test for object creation ok( $stemma->isa( 'Text::Tradition::Stemma' ), 'Got the right sort of object' ); diff --git a/t/text_tradition.t b/t/text_tradition.t index eae4e3a..dd13636 100644 --- a/t/text_tradition.t +++ b/t/text_tradition.t @@ -58,7 +58,7 @@ my $t = Text::Tradition->new( ); my $s; -ok( $s = $t->add_stemma( 't/data/simple.dot' ), "Added a simple stemma" ); +ok( $s = $t->add_stemma( dotfile => 't/data/simple.dot' ), "Added a simple stemma" ); is( ref( $s ), 'Text::Tradition::Stemma', "Got a stemma object returned" ); is( $t->stemma, $s, "Stemma is the right one" ); } diff --git a/t/text_tradition_directory.t b/t/text_tradition_directory.t index 4c4157a..e4de126 100644 --- a/t/text_tradition_directory.t +++ b/t/text_tradition_directory.t @@ -33,7 +33,7 @@ my $t = Text::Tradition->new( $uuid = $d->save( $t ); ok( $uuid, "Saved test tradition" ); - my $s = $t->add_stemma( 't/data/simple.dot' ); + my $s = $t->add_stemma( dotfile => 't/data/simple.dot' ); ok( $d->save( $t ), "Updated tradition with stemma" ); is( $d->tradition( $uuid ), $t, "Correct tradition returned for id" ); is( $d->tradition( $uuid )->stemma, $s, "...and it has the correct stemma" );