This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
RFC: what are applicable standards for exponent sizes?
[perl5.git] / t / op / glob.t
CommitLineData
a687059c
LW
1#!./perl
2
72b16652
GS
3BEGIN {
4 chdir 't' if -d 't';
20822f61 5 @INC = '../lib';
72b16652 6}
a687059c 7
fe4a5e1f 8print "1..10\n";
a687059c 9
0a753a76 10@oops = @ops = <op/*>;
a687059c 11
68dc0745 12if ($^O eq 'MSWin32') {
3cd616b9
WJ
13 map { $files{lc($_)}++ } <op/*>;
14 map { delete $files{"op/$_"} } split /[\s\n]/, `cmd /c "dir /b /l op & dir /b /l /ah op 2>nul"`,
68dc0745 15}
16else {
3cd616b9 17 map { $files{$_}++ } <op/*>;
68dc0745 18 map { delete $files{$_} } split /[\s\n]/, `echo op/*`;
19}
adbc4883
CB
20if (keys %files) {
21 print "not ok 1\t(",join(' ', sort keys %files),"\n";
22} else { print "ok 1\n"; }
a687059c
LW
23
24print $/ eq "\n" ? "ok 2\n" : "not ok 2\n";
25
fe14fcc3 26while (<jskdfjskdfj* op/* jskdjfjkosvk*>) {
a687059c
LW
27 $not = "not " unless $_ eq shift @ops;
28 $not = "not at all " if $/ eq "\0";
29}
30print "${not}ok 3\n";
31
32print $/ eq "\n" ? "ok 4\n" : "not ok 4\n";
0a753a76 33
34# test the "glob" operator
35$_ = "op/*";
36@glops = glob $_;
37print "@glops" eq "@oops" ? "ok 5\n" : "not ok 5\n";
38
39@glops = glob;
40print "@glops" eq "@oops" ? "ok 6\n" : "not ok 6\n";
ba112943
BS
41
42# glob should still work even after the File::Glob stash has gone away
43# (this used to dump core)
44my $i = 0;
45for (1..2) {
46 eval "<.>";
47 undef %File::Glob::;
48 ++$i;
49}
50print $i == 2 ? "ok 7\n" : "not ok 7\n";
fe4a5e1f
RS
51
52# [ID 20010526.001] localized glob loses value when assigned to
53
54$j=1; %j=(a=>1); @j=(1); local *j=*j; *j = sub{};
55
56print $j == 1 ? "ok 8\n" : "not ok 8\n";
57print $j{a} == 1 ? "ok 9\n" : "not ok 9\n";
58print $j[0] == 1 ? "ok 10\n" : "not ok 10\n";