11 @oops = @ops = <op/*>;
13 if ($^O eq 'MSWin32') {
14 map { $files{lc($_)}++ } <op/*>;
15 map { delete $files{"op/$_"} } split /[\s\n]/, `dir /b /l op & dir /b /l /ah op 2>nul`,
17 elsif ($^O eq 'VMS') {
18 map { $files{lc($_)}++ } <[.op]*>;
19 map { s/;.*$//; delete $files{lc($_)}; } split /[\n]/, `directory/noheading/notrailing/versions=1 [.op]`,
22 map { $files{$_}++ } <op/*>;
23 map { delete $files{$_} } split /\n/, `ls op/* | cat`;
25 ok( !(keys(%files)),'leftover op/* files' ) or diag(join(' ',sort keys %files));
27 cmp_ok($/,'eq',"\n",'sane input record separator');
30 while (<jskdfjskdfj* op/* jskdjfjkosvk*>) {
31 $not = "not " unless $_ eq shift @ops;
32 $not = "not at all " if $/ eq "\0";
34 ok(!$not,"glob amid garbage [$not]");
36 cmp_ok($/,'eq',"\n",'input record separator still sane');
40 cmp_ok("@glops",'eq',"@oops",'glob operator 1');
43 cmp_ok("@glops",'eq',"@oops",'glob operator 2');
45 # glob should still work even after the File::Glob stash has gone away
46 # (this used to dump core)
50 ok(!length($@),"eval'ed a glob $_");
54 cmp_ok($i,'==',2,'remove File::Glob stash');
56 # a more sinister version of the same test (crashes from 5.8 to 5.13.1)
59 local %CORE::GLOBAL::;
61 ok(!length($@),"remove File::Glob stash *and* CORE::GLOBAL::glob");
63 # Also try undeffing the typeglob itself, instead of hiding it
65 local *CORE::GLOBAL::glob;
66 ok eval { glob("0"); 1 },
67 'undefined *CORE::GLOBAL::glob{CODE} at run time';
69 # And hide the typeglob without hiding File::Glob (crashes from 5.8
72 local %CORE::GLOBAL::;
73 ok eval q{ glob("0"); 1 },
74 'undefined *CORE::GLOBAL::glob{CODE} at compile time';
77 # ... while ($var = glob(...)) should test definedness not truth
80 skip('no File::Glob to emulate Unix-ism', 1)
81 unless $INC{'File/Glob.pm'};
83 $ok = 1 while my $var = glob("0");
84 ok($ok,'define versus truth');
87 # The formerly-broken test for the situation above would accidentally
88 # test definedness for an assignment with a LOGOP on the right:
92 $ok = 0, undef $f while $x = $f||$f;
93 ok($ok,'test definedness with LOGOP');
96 cmp_ok(scalar(@oops),'>',0,'glob globbed something');
99 skip "~ globbing returns nothing on VMS", 1 if $^O eq 'VMS';
100 # This test exists mainly for miniperl, to test that external calls to
101 # csh, which clear %ENV first, leave $ENV{HOME}.
102 # On Windows, external glob uses File::DosGlob which returns "~", so
103 # this should pass anyway.
109 local *CORE::GLOBAL::glob = sub { ++$called };
110 eval 'CORE::glob("0")';
111 ok !$called, 'CORE::glob bypasses overrides';