From: Tara L Andrews Date: Fri, 3 Feb 2012 00:33:35 +0000 (+0100) Subject: initialize stemma array in tradition X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c3c7961291dc2703f5d532d004d301f1cc1db96e;p=scpubgit%2Fstemmatology.git initialize stemma array in tradition --- diff --git a/lib/Text/Tradition.pm b/lib/Text/Tradition.pm index 8801e30..8bed34d 100644 --- a/lib/Text/Tradition.pm +++ b/lib/Text/Tradition.pm @@ -44,6 +44,7 @@ has 'stemmata' => ( stemma_count => 'count', clear_stemmata => 'clear', }, + default => sub { [] }, ); # Create the witness before trying to add it @@ -306,6 +307,7 @@ my $t = Text::Tradition->new( 'file' => 't/data/simple.txt', ); +is( $t->stemma_count, 0, "No stemmas added yet" ); my $s; 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" ); diff --git a/t/text_tradition.t b/t/text_tradition.t index b48db29..6e47f40 100644 --- a/t/text_tradition.t +++ b/t/text_tradition.t @@ -57,6 +57,7 @@ my $t = Text::Tradition->new( 'file' => 't/data/simple.txt', ); +is( $t->stemma_count, 0, "No stemmas added yet" ); my $s; 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" );