From: tla Date: Sat, 6 Dec 2014 21:39:16 +0000 (+0100) Subject: Demonstrate failure mode for issue #28 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=85ccc0ecd5cd05f52d000787c87c821847f22292;p=scpubgit%2Fstemmatology.git Demonstrate failure mode for issue #28 --- diff --git a/base/lib/Text/Tradition/Parser/Self.pm b/base/lib/Text/Tradition/Parser/Self.pm index dbf3ece..68cf6aa 100644 --- a/base/lib/Text/Tradition/Parser/Self.pm +++ b/base/lib/Text/Tradition/Parser/Self.pm @@ -159,8 +159,19 @@ unless( $stemma_enabled ) { $nst = Text::Tradition->new( 'input' => 'Self', 'file' => 't/data/lexformat.xml' ); } [qr/DROPPING stemmata/], "Got expected stemma drop warning on parse"; +} else { + # Test parse of existing Stemweb job id + $t->set_stemweb_jobid( '1234' ); + $graphml_str = $t->collation->as_graphml; + try { + $newt = Text::Tradition->new( 'input' => 'Self', 'string' => $graphml_str ); + is( $newt->stemweb_jobid, '1234', "Stemweb job ID was reparsed" ); + } catch { + ok( 0, "Existing stemweb job ID causes parser to explode" ); + } } + =end testing =cut diff --git a/base/t/text_tradition_parser_self.t b/base/t/text_tradition_parser_self.t index df36d06..b2e5bba 100644 --- a/base/t/text_tradition_parser_self.t +++ b/base/t/text_tradition_parser_self.t @@ -72,6 +72,16 @@ unless( $stemma_enabled ) { $nst = Text::Tradition->new( 'input' => 'Self', 'file' => 't/data/lexformat.xml' ); } [qr/DROPPING stemmata/], "Got expected stemma drop warning on parse"; +} else { + # Test parse of existing Stemweb job id + $t->set_stemweb_jobid( '1234' ); + $graphml_str = $t->collation->as_graphml; + try { + $newt = Text::Tradition->new( 'input' => 'Self', 'string' => $graphml_str ); + is( $newt->stemweb_jobid, '1234', "Stemweb job ID was reparsed" ); + } catch { + ok( 0, "Existing stemweb job ID causes parser to explode" ); + } } }