1N/A#!./perl
1N/A
1N/ABEGIN {
1N/A chdir 't' if -d 't';
1N/A if ($^O eq 'MacOS') {
1N/A @INC = qw(: ::lib ::macos:lib);
1N/A } else {
1N/A @INC = '.';
1N/A push @INC, '../lib';
1N/A }
1N/A require Config; import Config;
1N/A if ($Config{'extensions'} !~ /\bFile\/Glob\b/i) {
1N/A print "1..0\n";
1N/A exit 0;
1N/A }
1N/A print "1..7\n";
1N/A}
1N/AEND {
1N/A print "not ok 1\n" unless $loaded;
1N/A}
1N/Ause File::Glob qw(:glob csh_glob);
1N/A$loaded = 1;
1N/Aprint "ok 1\n";
1N/A
1N/Amy $pat = $^O eq "MacOS" ? ":op:G*.t" : "op/G*.t";
1N/A
1N/A# Test the actual use of the case sensitivity tags, via csh_glob()
1N/Aimport File::Glob ':nocase';
1N/A@a = csh_glob($pat);
1N/Aprint "not " unless @a >= 8;
1N/Aprint "ok 2\n";
1N/A
1N/A# This may fail on systems which are not case-PRESERVING
1N/Aimport File::Glob ':case';
1N/A@a = csh_glob($pat); # None should be uppercase
1N/Aprint "not " unless @a == 0;
1N/Aprint "ok 3\n";
1N/A
1N/A# Test the explicit use of the GLOB_NOCASE flag
1N/A@a = bsd_glob($pat, GLOB_NOCASE);
1N/Aprint "not " unless @a >= 3;
1N/Aprint "ok 4\n";
1N/A
1N/A# Test Win32 backslash nastiness...
1N/Aif ($^O ne 'MSWin32' && $^O ne 'NetWare') {
1N/A print "ok 5\nok 6\nok 7\n";
1N/A}
1N/Aelse {
1N/A @a = File::Glob::glob("op\\g*.t");
1N/A print "not " unless @a >= 8;
1N/A print "ok 5\n";
1N/A mkdir "[]", 0;
1N/A @a = File::Glob::glob("\\[\\]", GLOB_QUOTE);
1N/A rmdir "[]";
1N/A print "# returned @a\nnot " unless @a == 1;
1N/A print "ok 6\n";
1N/A @a = bsd_glob("op\\*", GLOB_QUOTE);
1N/A print "not " if @a == 0;
1N/A print "ok 7\n";
1N/A}