autogenerate API listing from comments in the source (from Benjamin
[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';
6 print "1..7\n";
7}
8END {
9 print "not ok 1\n" unless $loaded;
10}
11use File::Glob qw(:glob csh_glob);
12$loaded = 1;
13print "ok 1\n";
14
15# Test the actual use of the case sensitivity tags, via csh_glob()
16import File::Glob ':nocase';
17@a = csh_glob("lib/G*.t"); # At least glob-basic.t glob-case.t glob-global.t
18print "not " unless @a >= 3;
19print "ok 2\n";
20
21# This may fail on systems which are not case-PRESERVING
22import File::Glob ':case';
23@a = csh_glob("lib/G*.t"); # None should be uppercase
24print "not " unless @a == 0;
25print "ok 3\n";
26
27# Test the explicit use of the GLOB_NOCASE flag
28@a = File::Glob::glob("lib/G*.t", GLOB_NOCASE);
29print "not " unless @a >= 3;
30print "ok 4\n";
31
32# Test Win32 backslash nastiness...
33if ($^O ne 'MSWin32') {
34 print "ok 5\nok 6\nok 7\n";
35}
36else {
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}