fix Tabular parser to account for a.c. wits; more doc and tests
[scpubgit/stemmatology.git] / t / text_tradition_witness.t
CommitLineData
7158714d 1#!/usr/bin/perl -w
2
3use strict;
4use Test::More 'no_plan';
5$| = 1;
6
7
8
9# =begin testing
10{
11use_ok( 'Text::Tradition::Witness', "can use module" );
12
13my @text = qw( This is a line of text );
14my $wit = Text::Tradition::Witness->new(
15 'sigil' => 'A',
16 'text' => \@text,
17 );
18is( ref( $wit ), 'Text::Tradition::Witness', 'Created a witness' );
19if( $wit ) {
20 is( $wit->sigil, 'A', "Witness has correct sigil" );
21 is( join( ' ', @{$wit->text} ), join( ' ', @text ), "Witness has correct text" );
22}
23}
24
25
26
27# =begin testing
28{
29use Text::Tradition;
30
31my $simple = 't/data/simple.txt';
32my $s = Text::Tradition->new(
33 'name' => 'inline',
34 'input' => 'Tabular',
35 'file' => $simple,
36 );
37my $wit_c = $s->witness( 'C' );
38is( ref( $wit_c ), 'Text::Tradition::Witness' ),;
39if( $wit_c ) {
40 ok( !$wit_c->has_text, "Text property not yet set" );
41 my $c_arr = $wit_c->text;
42 is( $c_arr->[0], 'Je', "Text constructed from path" );
43 ok( $wit_c->has_text, "Text property now set" );
44}
45}
46
47
48
49
501;