blob: 8403609578eb4607de44344174b5f91dd2c940e5 (
plain)
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
|
#!./perl
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require Config; import Config;
if ($Config{'extensions'} !~ /\bPOSIX\b/) {
print "1..0\n";
exit 0;
}
}
use DirHandle;
print "1..5\n";
$dot = new DirHandle ".";
print defined($dot) ? "ok" : "not ok", " 1\n";
@a = <*>;
do { $first = $dot->read } while defined($first) && $first =~ /^\./;
print +(grep { $_ eq $first } @a) ? "ok" : "not ok", " 2\n";
@b = sort($first, (grep {/^[^.]/} $dot->read));
print +(join("\0", @a) eq join("\0", @b)) ? "ok" : "not ok", " 3\n";
$dot->rewind;
@c = sort grep {/^[^.]/} $dot->read;
print +(join("\0", @b) eq join("\0", @c)) ? "ok" : "not ok", " 4\n";
$dot->close;
$dot->rewind;
print defined($dot->read) ? "not ok" : "ok", " 5\n";
|