rename File::Glob::glob() to File::Glob::bsd_glob() to avoid
[p5sagit/p5-mst-13.2.git] / t / lib / glob-case.t
CommitLineData
220398a0 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 unshift @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}
13END {
14 print "not ok 1\n" unless $loaded;
15}
16use File::Glob qw(:glob csh_glob);
17$loaded = 1;
18print "ok 1\n";
19
20# Test the actual use of the case sensitivity tags, via csh_glob()
21import File::Glob ':nocase';
22@a = csh_glob("lib/G*.t"); # At least glob-basic.t glob-case.t glob-global.t
23print "not " unless @a >= 3;
24print "ok 2\n";
25
26# This may fail on systems which are not case-PRESERVING
27import File::Glob ':case';
28@a = csh_glob("lib/G*.t"); # None should be uppercase
29print "not " unless @a == 0;
30print "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 34print "not " unless @a >= 3;
35print "ok 4\n";
36
37# Test Win32 backslash nastiness...
38if ($^O ne 'MSWin32') {
39 print "ok 5\nok 6\nok 7\n";
40}
41else {
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}