5 unshift @INC, '../lib';
6 require Config; import Config;
7 if ($Config{'extensions'} !~ /\bFile\/Glob\b/i) {
14 print "not ok 1\n" unless $loaded;
16 use File::Glob ':glob';
21 return '(', join(", ", map {defined $_ ? "\"$_\"" : "undef"} @a), ")\n";
24 # look for the contents of the current directory
26 delete @ENV{BASH_ENV, CDPATH, ENV, IFS};
28 if (opendir(D, ".")) {
29 @correct = grep { !/^\.\.?$/ } sort readdir(D);
32 @a = File::Glob::glob("*", 0);
34 if ("@a" ne "@correct" || GLOB_ERROR) {
35 print "# |@a| ne |@correct|\nnot ";
39 # look up the user's home directory
40 # should return a list with one item, and not set ERROR
41 if ($^O ne 'MSWin32') {
43 ($name, $home) = (getpwuid($>))[0,7];
46 @a = File::Glob::glob("~$name", GLOB_TILDE);
47 if (scalar(@a) != 1 || $a[0] ne $home || GLOB_ERROR) {
55 # should return a list with one item, and not set ERROR
56 @a = File::Glob::glob('TEST', GLOB_QUOTE);
57 if (scalar @a != 1 || $a[0] ne 'TEST' || GLOB_ERROR) {
64 # check nonexistent checks
65 # should return an empty list
66 # XXX since errfunc is NULL on win32, this test is not valid there
67 @a = File::Glob::glob("asdfasdf", 0);
68 if ($^O ne 'MSWin32' and scalar @a != 0) {
73 # check bad protections
74 # should return an empty list, and set ERROR
75 if ($^O eq 'mpeix' or $^O eq 'MSWin32' or $^O eq 'os2' or not $>) {
76 print "ok 6 # skipped\n";
79 $dir = "PtEeRsLt.dir";
81 @a = File::Glob::glob("$dir/*", GLOB_ERR);
82 #print "\@a = ", array(@a);
84 if (scalar(@a) != 0 || GLOB_ERROR == 0) {
90 # check for csh style globbing
91 @a = File::Glob::glob('{a,b}', GLOB_BRACE | GLOB_NOMAGIC);
92 unless (@a == 2 and $a[0] eq 'a' and $a[1] eq 'b') {
97 @a = File::Glob::glob(
98 '{TES*,doesntexist*,a,b}',
99 GLOB_BRACE | GLOB_NOMAGIC
110 # "~" should expand to $ENV{HOME}
111 $ENV{HOME} = "sweet home";
112 @a = File::Glob::glob('~', GLOB_TILDE | GLOB_NOMAGIC);
113 unless (@a == 1 and $a[0] eq $ENV{HOME}) {