1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 if ($^O eq 'MacOS') { 6 @INC = qw(: ::lib ::macos:lib); 7 } else { 8 @INC = '.'; 9 push @INC, '../lib'; 10 } 11 require Config; import Config; 12 if ($Config{'extensions'} !~ /\bFile\/Glob\b/i) { 13 print "1..0\n"; 14 exit 0; 15 } 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 25my $pat = $^O eq "MacOS" ? ":op:G*.t" : "op/G*.t"; 26 27# Test the actual use of the case sensitivity tags, via csh_glob() 28import File::Glob ':nocase'; 29@a = csh_glob($pat); 30print "not " unless @a >= 8; 31print "ok 2\n"; 32 33# This may fail on systems which are not case-PRESERVING 34import File::Glob ':case'; 35@a = csh_glob($pat); # None should be uppercase 36print "not " unless @a == 0; 37print "ok 3\n"; 38 39# Test the explicit use of the GLOB_NOCASE flag 40@a = bsd_glob($pat, GLOB_NOCASE); 41print "not " unless @a >= 3; 42print "ok 4\n"; 43 44# Test Win32 backslash nastiness... 45if ($^O ne 'MSWin32' && $^O ne 'NetWare') { 46 print "ok 5\nok 6\nok 7\n"; 47} 48else { 49 @a = File::Glob::glob("op\\g*.t"); 50 print "not " unless @a >= 8; 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"; 57 @a = bsd_glob("op\\*", GLOB_QUOTE); 58 print "not " if @a == 0; 59 print "ok 7\n"; 60} 61