4 use Test::More 'no_plan';
11 use_ok( 'Text::Tradition', "can use module" );
13 my $t = Text::Tradition->new( 'name' => 'empty' );
14 is( ref( $t ), 'Text::Tradition', "initialized an empty Tradition object" );
15 is( $t->name, 'empty', "object has the right name" );
16 is( scalar $t->witnesses, 0, "object has no witnesses" );
18 my $simple = 't/data/simple.txt';
19 my $s = Text::Tradition->new(
24 is( ref( $s ), 'Text::Tradition', "initialized a Tradition object" );
25 is( $s->name, 'inline', "object has the right name" );
26 is( scalar $s->witnesses, 3, "object has three witnesses" );
28 my $wit_a = $s->witness('A');
29 is( ref( $wit_a ), 'Text::Tradition::Witness', "Found a witness A" );
31 is( $wit_a->sigil, 'A', "Witness A has the right sigil" );
33 is( $s->witness('X'), undef, "There is no witness X" );
34 ok( !exists $s->{'witnesses'}->{'X'}, "Witness key X not created" );
36 my $wit_d = $s->add_witness( 'sigil' => 'D' );
37 is( ref( $wit_d ), 'Text::Tradition::Witness', "new witness created" );
38 is( $wit_d->sigil, 'D', "witness has correct sigil" );
39 is( scalar $s->witnesses, 4, "object now has four witnesses" );
41 my $del = $s->del_witness( 'D' );
42 is( $del, $wit_d, "Deleted correct witness" );
43 is( scalar $s->witnesses, 3, "object has three witnesses again" );
45 # TODO test initialization by witness list when we have it
54 my $t = Text::Tradition->new(
55 'name' => 'simple test',
57 'file' => 't/data/simple.txt',
61 ok( $s = $t->add_stemma( 't/data/simple.dot' ), "Added a simple stemma" );
62 is( ref( $s ), 'Text::Tradition::Stemma', "Got a stemma object returned" );
63 is( $t->stemma, $s, "Stemma is the right one" );