Commit | Line | Data |
a687059c |
1 | #!./perl |
2 | |
72b16652 |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
20822f61 |
5 | @INC = '../lib'; |
72b16652 |
6 | } |
a687059c |
7 | |
c682d774 |
8 | print "1..11\n"; |
a687059c |
9 | |
0a753a76 |
10 | @oops = @ops = <op/*>; |
a687059c |
11 | |
68dc0745 |
12 | if ($^O eq 'MSWin32') { |
3cd616b9 |
13 | map { $files{lc($_)}++ } <op/*>; |
6d0cc0d7 |
14 | map { delete $files{"op/$_"} } split /[\s\n]/, `dir /b /l op & dir /b /l /ah op 2>nul`, |
68dc0745 |
15 | } |
0405c3f2 |
16 | elsif ($^O eq 'VMS') { |
17 | map { $files{lc($_)}++ } <[.op]*>; |
18 | map { s/;.*$//; delete $files{lc($_)}; } split /[\n]/, `directory/noheading/notrailing/versions=1 [.op]`, |
19 | } |
68dc0745 |
20 | else { |
3cd616b9 |
21 | map { $files{$_}++ } <op/*>; |
68dc0745 |
22 | map { delete $files{$_} } split /[\s\n]/, `echo op/*`; |
23 | } |
adbc4883 |
24 | if (keys %files) { |
25 | print "not ok 1\t(",join(' ', sort keys %files),"\n"; |
26 | } else { print "ok 1\n"; } |
a687059c |
27 | |
28 | print $/ eq "\n" ? "ok 2\n" : "not ok 2\n"; |
29 | |
fe14fcc3 |
30 | while (<jskdfjskdfj* op/* jskdjfjkosvk*>) { |
a687059c |
31 | $not = "not " unless $_ eq shift @ops; |
32 | $not = "not at all " if $/ eq "\0"; |
33 | } |
34 | print "${not}ok 3\n"; |
35 | |
36 | print $/ eq "\n" ? "ok 4\n" : "not ok 4\n"; |
0a753a76 |
37 | |
38 | # test the "glob" operator |
39 | $_ = "op/*"; |
40 | @glops = glob $_; |
41 | print "@glops" eq "@oops" ? "ok 5\n" : "not ok 5\n"; |
42 | |
43 | @glops = glob; |
44 | print "@glops" eq "@oops" ? "ok 6\n" : "not ok 6\n"; |
ba112943 |
45 | |
46 | # glob should still work even after the File::Glob stash has gone away |
47 | # (this used to dump core) |
48 | my $i = 0; |
49 | for (1..2) { |
50 | eval "<.>"; |
51 | undef %File::Glob::; |
52 | ++$i; |
53 | } |
54 | print $i == 2 ? "ok 7\n" : "not ok 7\n"; |
fe4a5e1f |
55 | |
48beb55f |
56 | # ... while ($var = glob(...)) should test definedness not truth |
57 | |
58 | # Create a file called "0" |
bd2155e9 |
59 | print open(F, ">0") ? "ok 8\n" : "not ok 8 # $!\n"; |
9ea40b93 |
60 | close F; |
61 | |
bd2155e9 |
62 | my $ok = "not ok 9\n"; |
c682d774 |
63 | |
64 | # ... while ($var = glob(...)) should test definedness not truth |
65 | |
66 | my $ok = "not ok 11\n"; |
67 | $ok = "ok 11\n" while my $var = glob("0"); |
68 | print $ok; |
bd2155e9 |
69 | $ok = "ok 9\n" while my $var = glob("0"); |
48beb55f |
70 | print $ok; |
71 | |
bd2155e9 |
72 | print unlink("0") ? "ok 10\n" : "not ok 10\n"; |
73 | |
74 | END { |
75 | 1 while unlink "0"; |
76 | } |
77 | |