summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/t/lib/glob-basic.t
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2002-03-16 20:14:30 +0000
committermarkm <markm@FreeBSD.org>2002-03-16 20:14:30 +0000
commitb878a8b4fc512ca76116a7012802d385208857c3 (patch)
tree40ba760f36cd8e65b8c0a8caeaee00ceb84de622 /contrib/perl5/t/lib/glob-basic.t
parent96faff292d8b1b0bfcebddfb2f70f375ad79fec7 (diff)
parent3eac21f49bc763a6c0044b4afbc0c7ece760144f (diff)
downloadFreeBSD-src-b878a8b4fc512ca76116a7012802d385208857c3.zip
FreeBSD-src-b878a8b4fc512ca76116a7012802d385208857c3.tar.gz
This commit was generated by cvs2svn to compensate for changes in r92442,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/perl5/t/lib/glob-basic.t')
-rwxr-xr-xcontrib/perl5/t/lib/glob-basic.t36
1 files changed, 23 insertions, 13 deletions
diff --git a/contrib/perl5/t/lib/glob-basic.t b/contrib/perl5/t/lib/glob-basic.t
index 4728083..a014bfd 100755
--- a/contrib/perl5/t/lib/glob-basic.t
+++ b/contrib/perl5/t/lib/glob-basic.t
@@ -2,7 +2,12 @@
BEGIN {
chdir 't' if -d 't';
- unshift @INC, '../lib';
+ if ($^O eq 'MacOS') {
+ @INC = qw(: ::lib ::macos:lib);
+ } else {
+ @INC = '.';
+ push @INC, '../lib';
+ }
require Config; import Config;
if ($Config{'extensions'} !~ /\bFile\/Glob\b/i) {
print "1..0\n";
@@ -26,8 +31,8 @@ sub array {
$ENV{PATH} = "/bin";
delete @ENV{BASH_ENV, CDPATH, ENV, IFS};
@correct = ();
-if (opendir(D, ".")) {
- @correct = grep { !/^\.\.?$/ } sort readdir(D);
+if (opendir(D, $^O eq "MacOS" ? ":" : ".")) {
+ @correct = grep { !/^\./ } sort readdir(D);
closedir D;
}
@a = File::Glob::glob("*", 0);
@@ -39,12 +44,12 @@ print "ok 2\n";
# look up the user's home directory
# should return a list with one item, and not set ERROR
-if ($^O ne 'MSWin32' || $^O ne 'VMS') {
+if ($^O ne 'MSWin32' && $^O ne 'VMS') {
eval {
($name, $home) = (getpwuid($>))[0,7];
1;
} and do {
- @a = File::Glob::glob("~$name", GLOB_TILDE);
+ @a = bsd_glob("~$name", GLOB_TILDE);
if (scalar(@a) != 1 || $a[0] ne $home || GLOB_ERROR) {
print "not ";
}
@@ -54,7 +59,7 @@ print "ok 3\n";
# check backslashing
# should return a list with one item, and not set ERROR
-@a = File::Glob::glob('TEST', GLOB_QUOTE);
+@a = bsd_glob('TEST', GLOB_QUOTE);
if (scalar @a != 1 || $a[0] ne 'TEST' || GLOB_ERROR) {
local $/ = "][";
print "# [@a]\n";
@@ -65,7 +70,7 @@ print "ok 4\n";
# check nonexistent checks
# should return an empty list
# XXX since errfunc is NULL on win32, this test is not valid there
-@a = File::Glob::glob("asdfasdf", 0);
+@a = bsd_glob("asdfasdf", 0);
if ($^O ne 'MSWin32' and scalar @a != 0) {
print "# |@a|\nnot ";
}
@@ -81,7 +86,7 @@ if ($^O eq 'mpeix' or $^O eq 'MSWin32' or $^O eq 'os2' or $^O eq 'VMS'
else {
$dir = "PtEeRsLt.dir";
mkdir $dir, 0;
- @a = File::Glob::glob("$dir/*", GLOB_ERR);
+ @a = bsd_glob("$dir/*", GLOB_ERR);
#print "\@a = ", array(@a);
rmdir $dir;
if (scalar(@a) != 0 || GLOB_ERROR == 0) {
@@ -91,16 +96,21 @@ else {
}
# check for csh style globbing
-@a = File::Glob::glob('{a,b}', GLOB_BRACE | GLOB_NOMAGIC);
+@a = bsd_glob('{a,b}', GLOB_BRACE | GLOB_NOMAGIC);
unless (@a == 2 and $a[0] eq 'a' and $a[1] eq 'b') {
print "not ";
}
print "ok 7\n";
-@a = File::Glob::glob(
+@a = bsd_glob(
'{TES*,doesntexist*,a,b}',
- GLOB_BRACE | GLOB_NOMAGIC
+ GLOB_BRACE | GLOB_NOMAGIC | ($^O eq 'VMS' ? GLOB_NOCASE : 0)
);
+
+# Working on t/TEST often causes this test to fail because it sees temp
+# and RCS files. Filter them out, and .pm files too.
+@a = grep !/(,v$|~$|\.pm$)/, @a;
+
unless (@a == 3
and $a[0] eq ($^O eq 'VMS'? 'test.' : 'TEST')
and $a[1] eq 'a'
@@ -112,8 +122,8 @@ print "ok 8\n";
# "~" should expand to $ENV{HOME}
$ENV{HOME} = "sweet home";
-@a = File::Glob::glob('~', GLOB_TILDE | GLOB_NOMAGIC);
-unless (@a == 1 and $a[0] eq $ENV{HOME}) {
+@a = bsd_glob('~', GLOB_TILDE | GLOB_NOMAGIC);
+unless ($^O eq "MacOS" || (@a == 1 and $a[0] eq $ENV{HOME})) {
print "not ";
}
print "ok 9\n";
OpenPOWER on IntegriCloud