extra code in pp_concat, Take 2
[p5sagit/p5-mst-13.2.git] / lib / DirHandle.t
CommitLineData
c07a80fd 1#!./perl
2
3BEGIN {
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
13use DirHandle;
a3163838 14require './test.pl';
c07a80fd 15
a3163838 16plan(5);
c07a80fd 17
95e8664e 18$dot = new DirHandle ($^O eq 'MacOS' ? ':' : '.');
19
a3163838 20ok(defined($dot));
c07a80fd 21
1b4456a8 22@a = sort <*>;
c07a80fd 23do { $first = $dot->read } while defined($first) && $first =~ /^\./;
a3163838 24ok(+(grep { $_ eq $first } @a));
c07a80fd 25
26@b = sort($first, (grep {/^[^.]/} $dot->read));
a3163838 27ok(+(join("\0", @a) eq join("\0", @b)));
c07a80fd 28
29$dot->rewind;
30@c = sort grep {/^[^.]/} $dot->read;
a3163838 31cmp_ok(+(join("\0", @b), 'eq', join("\0", @c)));
c07a80fd 32
33$dot->close;
34$dot->rewind;
a3163838 35ok(!defined($dot->read));