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