Commit | Line | Data |
---|---|---|
c07a80fd | 1 | #!./perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
20822f61 | 5 | @INC = '../lib'; |
c07a80fd | 6 | require Config; import Config; |
1b4456a8 | 7 | if (not $Config{'d_readdir'}) { |
c07a80fd | 8 | print "1..0\n"; |
9 | exit 0; | |
10 | } | |
11 | } | |
12 | ||
13 | use DirHandle; | |
14 | ||
15 | print "1..5\n"; | |
16 | ||
95e8664e CN |
17 | $dot = new DirHandle ($^O eq 'MacOS' ? ':' : '.'); |
18 | ||
c07a80fd | 19 | print defined($dot) ? "ok" : "not ok", " 1\n"; |
20 | ||
1b4456a8 | 21 | @a = sort <*>; |
c07a80fd | 22 | do { $first = $dot->read } while defined($first) && $first =~ /^\./; |
23 | print +(grep { $_ eq $first } @a) ? "ok" : "not ok", " 2\n"; | |
24 | ||
25 | @b = sort($first, (grep {/^[^.]/} $dot->read)); | |
26 | print +(join("\0", @a) eq join("\0", @b)) ? "ok" : "not ok", " 3\n"; | |
27 | ||
28 | $dot->rewind; | |
29 | @c = sort grep {/^[^.]/} $dot->read; | |
30 | print +(join("\0", @b) eq join("\0", @c)) ? "ok" : "not ok", " 4\n"; | |
31 | ||
32 | $dot->close; | |
33 | $dot->rewind; | |
34 | print defined($dot->read) ? "not ok" : "ok", " 5\n"; |