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' } );
# =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;
"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' );