forked from OpenKore/openkore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextReaderTest.pm
More file actions
36 lines (28 loc) · 934 Bytes
/
TextReaderTest.pm
File metadata and controls
36 lines (28 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package Utils::TextReaderTest;
use strict;
use warnings;
use Test::More;
use Utils::TextReader;
sub start {
my $reader = Utils::TextReader->new( 'data/parent.txt' );
subtest '!include support' => sub {
is( $reader->readLine, "parent A\n" );
is( $reader->readLine, "child\n" );
is( $reader->readLine, "parent B\n" );
is( $reader->readLine, "a\n" );
is( $reader->readLine, "child\n" );
is( $reader->readLine, "parent C\n" );
is( $reader->readLine, undef );
is( $reader->eof, 1 );
};
subtest '!include_create_if_missing support' => sub {
my $reader = Utils::TextReader->new( 'data/create_if_missing.txt' );
# Make sure the referenced child doesn't exist.
unlink 'data/create_if_missing_child.txt';
ok( !-e 'data/create_if_missing_child.txt' );
# Processing the file should create the referenced child.
$reader->readLine while !$reader->eof;
ok( -e 'data/create_if_missing_child.txt' );
};
}
1;