NetWare port from Guruprasad S <SGURUPRASAD@novell.com>.
[p5sagit/p5-mst-13.2.git] / t / lib / glob-case.t
CommitLineData
220398a0 1#!./perl
2
3BEGIN {
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}
18END {
19 print "not ok 1\n" unless $loaded;
20}
21use File::Glob qw(:glob csh_glob);
22$loaded = 1;
23print "ok 1\n";
24
7369a524 25my $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()
28import File::Glob ':nocase';
7369a524 29@a = csh_glob($pat); # At least glob-basic.t glob-case.t glob-global.t
220398a0 30print "not " unless @a >= 3;
31print "ok 2\n";
32
33# This may fail on systems which are not case-PRESERVING
34import File::Glob ':case';
7369a524 35@a = csh_glob($pat); # None should be uppercase
220398a0 36print "not " unless @a == 0;
37print "ok 3\n";
38
39# Test the explicit use of the GLOB_NOCASE flag
7369a524 40@a = bsd_glob($pat, GLOB_NOCASE);
220398a0 41print "not " unless @a >= 3;
42print "ok 4\n";
43
44# Test Win32 backslash nastiness...
2986a63f 45if ($^O ne 'MSWin32' && $^O ne 'NetWare') {
220398a0 46 print "ok 5\nok 6\nok 7\n";
47}
48else {
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}