Skip to content

Commit cdf4639

Browse files
committed
basic nqp::eoffh tests
1 parent e1635d7 commit cdf4639

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

t/nqp/19-file-ops.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Test nqp::op file operations.
44

5-
plan(54);
5+
plan(57);
66

77
ok( nqp::stat('CREDITS', nqp::const::STAT_EXISTS) == 1, 'nqp::stat exists');
88
ok( nqp::stat('AARDVARKS', nqp::const::STAT_EXISTS) == 0, 'nqp::stat not exists');
@@ -16,11 +16,14 @@ ok( nqp::stat('t', nqp::const::STAT_ISREG) == 0, 'nqp::stat not regular file');
1616
my $credits := nqp::open('CREDITS', 'r');
1717
ok( $credits, 'nqp::open for read');
1818
ok( nqp::tellfh($credits) == 0, 'nqp::tellfh start of file');
19+
ok( !nqp::eoffh($credits), 'Not at EOF after open');
1920
my $line := nqp::readlinefh($credits);
21+
ok( !nqp::eoffh($credits), 'Not at EOF after first line read');
2022
ok( nqp::chars($line) == 5 || nqp::chars($line) == 6, 'nqp::readlinefh line to read'); # =pod\r?\n
2123
ok( nqp::tellfh($credits) == 5 || nqp::tellfh($credits) == 6, 'nqp::tellfh line two');
2224
my $rest := nqp::readallfh($credits);
2325
ok( nqp::chars($rest) > 100, 'nqp::readallfh lines to read');
26+
ok( nqp::eoffh($credits), 'handle now at EOF');
2427
ok( nqp::tellfh($credits) == nqp::chars($line) + nqp::chars($rest), 'nqp::tellfh end of file');
2528

2629
ok( nqp::chars(nqp::readlinefh($credits)) == 0, 'nqp::readlinefh end of file');

0 commit comments

Comments
 (0)