# =begin testing
{
use Text::Tradition;
+use TryCatch;
use_ok( 'Text::Tradition::Collation::RelationshipStore' );
+
+# Add some relationships, and delete them
+
+my $cxfile = 't/data/Collatex-16.xml';
+my $t = Text::Tradition->new(
+ 'name' => 'inline',
+ 'input' => 'CollateX',
+ 'file' => $cxfile,
+ );
+my $c = $t->collation;
+
+my @v1 = $c->add_relationship( 'n21', 'n22', { 'type' => 'meaning' } );
+is( scalar @v1, 1, "Added a single relationship" );
+is( $v1[0]->[0], 'n21', "Got correct node 1" );
+is( $v1[0]->[1], 'n22', "Got correct node 2" );
+my @v2 = $c->add_relationship( 'n9', 'n23',
+ { 'type' => 'spelling', 'scope' => 'global' } );
+is( scalar @v2, 2, "Added a global relationship with two instances" );
+@v1 = $c->del_relationship( 'n22', 'n21' );
+is( scalar @v1, 1, "Deleted first relationship" );
+@v2 = $c->del_relationship( 'n8', 'n13' );
+is( scalar @v2, 2, "Deleted second global relationship" );
+try {
+ my @v3 = $c->del_relationship( 'n1', 'n2' );
+ ok( 0, "Should have errored on non-existent relationship" );
+} catch( Text::Tradition::Error $e ) {
+ like( $e->message, qr/No relationship defined/, "Attempt to delete non-existent relationship errored" );
+}
}