1N/A#!./perl
1N/A
1N/ABEGIN {
1N/A chdir 't' if -d 't';
1N/A @INC = '../lib';
1N/A}
1N/A
1N/Aeval 'opendir(NOSUCH, "no/such/directory");';
1N/Aif ($@) { print "1..0\n"; exit; }
1N/A
1N/Aprint "1..11\n";
1N/A
1N/Afor $i (1..2000) {
1N/A local *OP;
1N/A opendir(OP, "op") or die "can't opendir: $!";
1N/A # should auto-closedir() here
1N/A}
1N/A
1N/Aif (opendir(OP, "op")) { print "ok 1\n"; } else { print "not ok 1\n"; }
1N/A@D = grep(/^[^\.].*\.t$/i, readdir(OP));
1N/Aclosedir(OP);
1N/A
1N/A##
1N/A## This range will have to adjust as the number of tests expands,
1N/A## as it's counting the number of .t files in src/t
1N/A##
1N/Amy ($min, $max) = (115, 135);
1N/Aif (@D > $min && @D < $max) { print "ok 2\n"; }
1N/Aelse {
1N/A printf "not ok 2 # counting op/*.t, expect $min < %d < $max files\n",
1N/A scalar @D;
1N/A}
1N/A
1N/A@R = sort @D;
1N/A@G = sort <op/*.t>;
1N/A@G = sort <:op:*.t> if $^O eq 'MacOS';
1N/Aif ($G[0] =~ m#.*\](\w+\.t)#i) {
1N/A # grep is to convert filespecs returned from glob under VMS to format
1N/A # identical to that returned by readdir
1N/A @G = grep(s#.*\](\w+\.t).*#op/$1#i,<op/*.t>);
1N/A}
1N/Awhile (@R && @G && $G[0] eq ($^O eq 'MacOS' ? ':op:' : 'op/').$R[0]) {
1N/A shift(@R);
1N/A shift(@G);
1N/A}
1N/Aif (@R == 0 && @G == 0) { print "ok 3\n"; } else { print "not ok 3\n"; }
1N/A
1N/Aif (opendir($fh, "op")) { print "ok 4\n"; } else { print "not ok 4\n"; }
1N/Aif (ref($fh) eq 'GLOB') { print "ok 5\n"; } else { print "not ok 5\n"; }
1N/Aif (opendir($fh[0], "op")) { print "ok 6\n"; } else { print "not ok 6\n"; }
1N/Aif (ref($fh[0]) eq 'GLOB') { print "ok 7\n"; } else { print "not ok 7\n"; }
1N/Aif (opendir($fh{abc}, "op")) { print "ok 8\n"; } else { print "not ok 8\n"; }
1N/Aif (ref($fh{abc}) eq 'GLOB') { print "ok 9\n"; } else { print "not ok 9\n"; }
1N/Aif ("$fh" ne "$fh[0]") { print "ok 10\n"; } else { print "not ok 10\n"; }
1N/Aif ("$fh" ne "$fh{abc}") { print "ok 11\n"; } else { print "not ok 11\n"; }