5 unshift @INC, '../lib';
10 print "not ok 1\n" unless $loaded;
12 use File::Glob ':glob';
17 return '(', join(", ", map {defined $_ ? "\"$_\"" : "undef"} @a), ")\n";
20 # look for the contents of the current directory
22 delete @ENV{BASH_ENV, CDPATH, ENV, IFS};
24 if (opendir(D, ".")) {
25 @correct = grep { !/^\.\.?$/ } sort readdir(D);
28 @a = File::Glob::glob("*", 0);
30 if ("@a" ne "@correct" || GLOB_ERROR) {
31 print "# |@a| ne |@correct|\nnot ";
35 # look up the user's home directory
36 # should return a list with one item, and not set ERROR
37 if ($^O ne 'MSWin32') {
38 ($name, $home) = (getpwuid($>))[0,7];
39 @a = File::Glob::glob("~$name", GLOB_TILDE);
40 if (scalar(@a) != 1 || $a[0] ne $home || GLOB_ERROR) {
47 # should return a list with one item, and not set ERROR
48 @a = File::Glob::glob('TEST', GLOB_QUOTE);
49 if (scalar @a != 1 || $a[0] ne 'TEST' || GLOB_ERROR) {
56 # check nonexistent checks
57 # should return an empty list
58 # XXX since errfunc is NULL on win32, this test is not valid there
59 @a = File::Glob::glob("asdfasdf", 0);
60 if ($^O ne 'MSWin32' and scalar @a != 0) {
65 # check bad protections
66 # should return an empty list, and set ERROR
67 $dir = "PtEeRsLt.dir";
69 @a = File::Glob::glob("$dir/*", GLOB_ERR);
70 #print "\@a = ", array(@a);
72 if (scalar(@a) != 0 || ($^O ne 'MSWin32' && GLOB_ERROR == 0)) {
77 # check for csh style globbing
78 @a = File::Glob::glob('{a,b}', GLOB_BRACE | GLOB_NOMAGIC);
79 unless (@a == 2 and $a[0] eq 'a' and $a[1] eq 'b') {
84 @a = File::Glob::glob(
85 '{TES*,doesntexist*,a,b}',
86 GLOB_BRACE | GLOB_NOMAGIC
97 # "~" should expand to $ENV{HOME}
98 $ENV{HOME} = "sweet home";
99 @a = File::Glob::glob('~', GLOB_TILDE | GLOB_NOMAGIC);
100 unless (@a == 1 and $a[0] eq $ENV{HOME}) {