misc tweaks
[p5sagit/p5-mst-13.2.git] / t / lib / io_dup.t
old mode 100644 (file)
new mode 100755 (executable)
index ac17683..6b0caf1
@@ -1,11 +1,20 @@
 #!./perl
 
 BEGIN {
-    @INC = '../lib';
-    require Config; import Config;
-    if ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS') {
-       print "1..0\n";
-       exit 0;
+    unless(grep /blib/, @INC) {
+       chdir 't' if -d 't';
+       @INC = '../lib' if -d '../lib';
+    }
+}
+
+use Config;
+
+BEGIN {
+    if(-d "lib" && -f "TEST") {
+        if ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS') {
+           print "1..0\n";
+           exit 0;
+        }
     }
 }
 
@@ -30,8 +39,14 @@ $stderr->fdopen($stdout,"w");
 
 print $stdout "ok 2\n";
 print $stderr "ok 3\n";
-system 'echo ok 4';
-system 'echo ok 5 1>&2';
+if ($^O eq 'MSWin32') {
+    print `echo ok 4`;
+    print `echo ok 5 1>&2`; # does this *really* work?
+}
+else {
+    system 'echo ok 4';
+    system 'echo ok 5 1>&2';
+}
 
 $stderr->close;
 $stdout->close;
@@ -39,7 +54,8 @@ $stdout->close;
 $stdout->fdopen($dupout,"w");
 $stderr->fdopen($duperr,"w");
 
-system 'cat Io.dup';
+if ($^O eq 'MSWin32') { print `type Io.dup` }
+else                  { system 'cat Io.dup' }
 unlink 'Io.dup';
 
 print STDOUT "ok 6\n";