Quick integration of mainline changes to date
[p5sagit/p5-mst-13.2.git] / t / lib / glob-case.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     unshift @INC, '../lib';
6     print "1..7\n";
7 }
8 END {
9     print "not ok 1\n" unless $loaded;
10 }
11 use File::Glob qw(:glob csh_glob);
12 $loaded = 1;
13 print "ok 1\n";
14
15 # Test the actual use of the case sensitivity tags, via csh_glob()
16 import File::Glob ':nocase';
17 @a = csh_glob("lib/G*.t"); # At least glob-basic.t glob-case.t glob-global.t
18 print "not " unless @a >= 3;
19 print "ok 2\n";
20
21 # This may fail on systems which are not case-PRESERVING
22 import File::Glob ':case';
23 @a = csh_glob("lib/G*.t"); # None should be uppercase
24 print "not " unless @a == 0;
25 print "ok 3\n";
26
27 # Test the explicit use of the GLOB_NOCASE flag
28 @a = File::Glob::glob("lib/G*.t", GLOB_NOCASE);
29 print "not " unless @a >= 3;
30 print "ok 4\n";
31
32 # Test Win32 backslash nastiness...
33 if ($^O ne 'MSWin32') {
34     print "ok 5\nok 6\nok 7\n";
35 }
36 else {
37     @a = File::Glob::glob("lib\\g*.t");
38     print "not " unless @a >= 3;
39     print "ok 5\n";
40     mkdir "[]", 0;
41     @a = File::Glob::glob("\\[\\]", GLOB_QUOTE);
42     rmdir "[]";
43     print "# returned @a\nnot " unless @a == 1;
44     print "ok 6\n";
45     @a = File::Glob::glob("lib\\*", GLOB_QUOTE);
46     print "not " if @a == 0;
47     print "ok 7\n";
48 }