Commit | Line | Data |
220398a0 |
1 | #!./perl |
2 | |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
7369a524 |
5 | if ($^O eq 'MacOS') { |
6 | @INC = qw(: ::lib ::macos:lib); |
7 | } else { |
8 | @INC = '.'; |
9 | push @INC, '../lib'; |
10 | } |
d2a01882 |
11 | require Config; import Config; |
12 | if ($Config{'extensions'} !~ /\bFile\/Glob\b/i) { |
13 | print "1..0\n"; |
14 | exit 0; |
15 | } |
220398a0 |
16 | print "1..7\n"; |
17 | } |
18 | END { |
19 | print "not ok 1\n" unless $loaded; |
20 | } |
21 | use File::Glob qw(:glob csh_glob); |
22 | $loaded = 1; |
23 | print "ok 1\n"; |
24 | |
7369a524 |
25 | my $pat = $^O eq "MacOS" ? ":lib:G*.t" : "lib/G*.t"; |
26 | |
220398a0 |
27 | # Test the actual use of the case sensitivity tags, via csh_glob() |
28 | import File::Glob ':nocase'; |
7369a524 |
29 | @a = csh_glob($pat); # At least glob-basic.t glob-case.t glob-global.t |
220398a0 |
30 | print "not " unless @a >= 3; |
31 | print "ok 2\n"; |
32 | |
33 | # This may fail on systems which are not case-PRESERVING |
34 | import File::Glob ':case'; |
7369a524 |
35 | @a = csh_glob($pat); # None should be uppercase |
220398a0 |
36 | print "not " unless @a == 0; |
37 | print "ok 3\n"; |
38 | |
39 | # Test the explicit use of the GLOB_NOCASE flag |
7369a524 |
40 | @a = bsd_glob($pat, GLOB_NOCASE); |
220398a0 |
41 | print "not " unless @a >= 3; |
42 | print "ok 4\n"; |
43 | |
44 | # Test Win32 backslash nastiness... |
45 | if ($^O ne 'MSWin32') { |
46 | print "ok 5\nok 6\nok 7\n"; |
47 | } |
48 | else { |
49 | @a = File::Glob::glob("lib\\g*.t"); |
50 | print "not " unless @a >= 3; |
51 | print "ok 5\n"; |
52 | mkdir "[]", 0; |
53 | @a = File::Glob::glob("\\[\\]", GLOB_QUOTE); |
54 | rmdir "[]"; |
55 | print "# returned @a\nnot " unless @a == 1; |
56 | print "ok 6\n"; |
00c80938 |
57 | @a = bsd_glob("lib\\*", GLOB_QUOTE); |
220398a0 |
58 | print "not " if @a == 0; |
59 | print "ok 7\n"; |
60 | } |