remove some debugging statements
[scpubgit/stemmatology.git] / t / text_tradition_collation_relationshipstore.t
index 16724a6..4f666e0 100644 (file)
@@ -17,10 +17,10 @@ use_ok( 'Text::Tradition::Collation::RelationshipStore' );
 
 my $cxfile = 't/data/Collatex-16.xml';
 my $t = Text::Tradition->new( 
-    'name'  => 'inline', 
-    'input' => 'CollateX',
-    'file'  => $cxfile,
-    );
+       'name'  => 'inline', 
+       'input' => 'CollateX',
+       'file'  => $cxfile,
+       );
 my $c = $t->collation;
 
 my @v1 = $c->add_relationship( 'n21', 'n22', { 'type' => 'lexical' } );
@@ -42,10 +42,16 @@ is( scalar @v3, 0, "Nothing deleted on non-existent relationship" );
 
 # =begin testing
 {
+use Test::Warn;
 use Text::Tradition;
 use TryCatch;
 
-my $t1 = Text::Tradition->new( 'input' => 'Self', 'file' => 't/data/legendfrag.xml' );
+my $t1;
+warning_is {
+       $t1 = Text::Tradition->new( 'input' => 'Self', 'file' => 't/data/legendfrag.xml' );
+} 'DROPPING r14.2 -> r8.1: Cannot set relationship on a meta reading',
+       "Got expected relationship drop warning on parse";
+
 # Test 1.1: try to equate nodes that are prevented with an intermediate collation
 ok( $t1, "Parsed test fragment file" );
 my $c1 = $t1->collation;
@@ -87,9 +93,23 @@ try {
                "Relationship link prevented for a meta reading" );
 }
 
+# Test 1.4: try to break a relationship near a meta reading
+$c1->add_relationship( 'r7.6', 'r7.3', { type => 'orthographic' } );
+try {
+       $c1->del_relationship( 'r7.6', 'r7.7' );
+       $c1->del_relationship( 'r7.6', 'r7.3' );
+       ok( 1, "Relationship broken with a meta reading as neighbor" );
+} catch {
+       ok( 0, "Relationship deletion failed with a meta reading as neighbor" );
+}
+
 # Test 2.1: try to equate nodes that are prevented with a real intermediate
 # equivalence
-my $t2 = Text::Tradition->new( 'input' => 'Self', 'file' => 't/data/legendfrag.xml' );
+my $t2;
+warning_is {
+       $t2 = Text::Tradition->new( 'input' => 'Self', 'file' => 't/data/legendfrag.xml' );
+} 'DROPPING r14.2 -> r8.1: Cannot set relationship on a meta reading',
+       "Got expected relationship drop warning on parse";
 my $c2 = $t2->collation;
 $c2->add_relationship( 'r9.2', 'r9.3', { 'type' => 'lexical' } );
 my $trel2 = $c2->get_relationship( 'r9.2', 'r9.3' );