1*0Sstevel@tonic-gate#!./perl 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateBEGIN { 4*0Sstevel@tonic-gate chdir 't' if -d 't'; 5*0Sstevel@tonic-gate @INC = '../lib'; 6*0Sstevel@tonic-gate} 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gateeval 'opendir(NOSUCH, "no/such/directory");'; 9*0Sstevel@tonic-gateif ($@) { print "1..0\n"; exit; } 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gateprint "1..11\n"; 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gatefor $i (1..2000) { 14*0Sstevel@tonic-gate local *OP; 15*0Sstevel@tonic-gate opendir(OP, "op") or die "can't opendir: $!"; 16*0Sstevel@tonic-gate # should auto-closedir() here 17*0Sstevel@tonic-gate} 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gateif (opendir(OP, "op")) { print "ok 1\n"; } else { print "not ok 1\n"; } 20*0Sstevel@tonic-gate@D = grep(/^[^\.].*\.t$/i, readdir(OP)); 21*0Sstevel@tonic-gateclosedir(OP); 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gate## 24*0Sstevel@tonic-gate## This range will have to adjust as the number of tests expands, 25*0Sstevel@tonic-gate## as it's counting the number of .t files in src/t 26*0Sstevel@tonic-gate## 27*0Sstevel@tonic-gatemy ($min, $max) = (115, 135); 28*0Sstevel@tonic-gateif (@D > $min && @D < $max) { print "ok 2\n"; } 29*0Sstevel@tonic-gateelse { 30*0Sstevel@tonic-gate printf "not ok 2 # counting op/*.t, expect $min < %d < $max files\n", 31*0Sstevel@tonic-gate scalar @D; 32*0Sstevel@tonic-gate} 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate@R = sort @D; 35*0Sstevel@tonic-gate@G = sort <op/*.t>; 36*0Sstevel@tonic-gate@G = sort <:op:*.t> if $^O eq 'MacOS'; 37*0Sstevel@tonic-gateif ($G[0] =~ m#.*\](\w+\.t)#i) { 38*0Sstevel@tonic-gate # grep is to convert filespecs returned from glob under VMS to format 39*0Sstevel@tonic-gate # identical to that returned by readdir 40*0Sstevel@tonic-gate @G = grep(s#.*\](\w+\.t).*#op/$1#i,<op/*.t>); 41*0Sstevel@tonic-gate} 42*0Sstevel@tonic-gatewhile (@R && @G && $G[0] eq ($^O eq 'MacOS' ? ':op:' : 'op/').$R[0]) { 43*0Sstevel@tonic-gate shift(@R); 44*0Sstevel@tonic-gate shift(@G); 45*0Sstevel@tonic-gate} 46*0Sstevel@tonic-gateif (@R == 0 && @G == 0) { print "ok 3\n"; } else { print "not ok 3\n"; } 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gateif (opendir($fh, "op")) { print "ok 4\n"; } else { print "not ok 4\n"; } 49*0Sstevel@tonic-gateif (ref($fh) eq 'GLOB') { print "ok 5\n"; } else { print "not ok 5\n"; } 50*0Sstevel@tonic-gateif (opendir($fh[0], "op")) { print "ok 6\n"; } else { print "not ok 6\n"; } 51*0Sstevel@tonic-gateif (ref($fh[0]) eq 'GLOB') { print "ok 7\n"; } else { print "not ok 7\n"; } 52*0Sstevel@tonic-gateif (opendir($fh{abc}, "op")) { print "ok 8\n"; } else { print "not ok 8\n"; } 53*0Sstevel@tonic-gateif (ref($fh{abc}) eq 'GLOB') { print "ok 9\n"; } else { print "not ok 9\n"; } 54*0Sstevel@tonic-gateif ("$fh" ne "$fh[0]") { print "ok 10\n"; } else { print "not ok 10\n"; } 55*0Sstevel@tonic-gateif ("$fh" ne "$fh{abc}") { print "ok 11\n"; } else { print "not ok 11\n"; } 56