YA sync with mainline
[p5sagit/p5-mst-13.2.git] / t / lib / glob-basic.t
index 5189db4..b967e8d 100755 (executable)
@@ -3,7 +3,11 @@
 BEGIN {
     chdir 't' if -d 't';
     unshift @INC, '../lib';
-
+    require Config; import Config;
+    if ($Config{'extensions'} !~ /\bFile\/Glob\b/i) {
+        print "1..0\n";
+        exit 0;
+    }
     print "1..9\n";
 }
 END {
@@ -34,12 +38,16 @@ 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') {
+if ($^O ne 'MSWin32' || $^O ne 'VMS') {
+  eval {
     ($name, $home) = (getpwuid($>))[0,7];
+    1;
+  } and do {
     @a = File::Glob::glob("~$name", GLOB_TILDE);
     if (scalar(@a) != 1 || $a[0] ne $home || GLOB_ERROR) {
        print "not ";
     }
+  };
 }
 print "ok 3\n";
 
@@ -64,15 +72,20 @@ print "ok 5\n";
 
 # check bad protections
 # should return an empty list, and set ERROR
-$dir = "PtEeRsLt.dir";
-mkdir $dir, 0;
-@a = File::Glob::glob("$dir/*", GLOB_ERR);
-#print "\@a = ", array(@a);
-rmdir $dir;
-if (scalar(@a) != 0 || ($^O ne 'MSWin32' && GLOB_ERROR == 0)) {
-    print "not ";
+if ($^O eq 'mpeix' or $^O eq 'MSWin32' or $^O eq 'os2' or $^O eq 'VMS' or $^O eq 'cygwin' or not $>) {
+    print "ok 6 # skipped\n";
+}
+else {
+    $dir = "PtEeRsLt.dir";
+    mkdir $dir, 0;
+    @a = File::Glob::glob("$dir/*", GLOB_ERR);
+    #print "\@a = ", array(@a);
+    rmdir $dir;
+    if (scalar(@a) != 0 || GLOB_ERROR == 0) {
+       print "not ";
+    }
+    print "ok 6\n";
 }
-print "ok 6\n";
 
 # check for csh style globbing
 @a = File::Glob::glob('{a,b}', GLOB_BRACE | GLOB_NOMAGIC);
@@ -86,7 +99,7 @@ print "ok 7\n";
     GLOB_BRACE | GLOB_NOMAGIC
 );
 unless (@a == 3
-        and $a[0] eq 'TEST'
+        and $a[0] eq ($^O eq 'VMS'? 'test.' : 'TEST')
         and $a[1] eq 'a'
         and $a[2] eq 'b')
 {