don't try to test cmd or powershell on cygwin
[p5sagit/local-lib.git] / t / shell.t
index 0d5ce61..047d49c 100644 (file)
--- a/t/shell.t
+++ b/t/shell.t
@@ -35,23 +35,34 @@ for my $shell (
   },
   {
     name => 'cmd',
-    opt => '/D /C',
+    opt => '/Q /D /C',
     ext => 'bat',
     perl => qq{@"$^X"},
+    skip => $^O eq 'cygwin',
   },
   {
     name => 'powershell',
-    opt => '-NoProfile -ExecutionPolicy Unrestricted',
+    opt => '-NoProfile -ExecutionPolicy Unrestricted -File',
     ext => 'ps1',
     perl => qq{& '$^X'},
+    skip => $^O eq 'cygwin',
   },
 ) {
   my $name = $shell->{name};
-  next
-    if @ARGV && !grep {$_ eq $name} @ARGV;
-  $shell->{shell} = which($name) || next;
+  $shell->{shell} = which($name);
   $shell->{ext}   ||= $name;
   $shell->{perl}  ||= qq{"$^X"};
+  if (@ARGV) {
+    next
+      if !grep {$_ eq $name} @ARGV;
+    if (!$shell->{shell}) {
+      warn "unable to find executable for $name";
+      next;
+    }
+  }
+  elsif ($shell->{skip} || !$shell->{shell}) {
+    next;
+  }
   push @shells, $shell;
 }