/Compress/ modules are at version 2.021. Remove vestigal MAPs and comments.
[p5sagit/p5-mst-13.2.git] / ext / POSIX / t / termios.t
index bd21232..7c3deb6 100644 (file)
@@ -1,18 +1,19 @@
 #!perl -T
 
 BEGIN {
-    if ($ENV{PERL_CORE}) {
-        chdir 't';
-        @INC = '../lib';
-    }
-
     use Config;
     use Test::More;
-    plan skip_all => "POSIX is unavailable" if $Config{'extensions'} !~ m!\bPOSIX\b!;
+    plan skip_all => "POSIX is unavailable" 
+        if $Config{'extensions'} !~ m!\bPOSIX\b!;
 }
-
 use strict;
 use POSIX;
+BEGIN {
+    plan skip_all => "POSIX::Termios not implemented" 
+        if  !eval "POSIX::Termios->new;1"
+        and $@=~/not implemented/;
+}
+
 
 my @getters = qw(getcflag getiflag getispeed getlflag getoflag getospeed);
 
@@ -27,9 +28,25 @@ ok( defined $termios, "\tchecking if the object is defined" );
 isa_ok( $termios, "POSIX::Termios", "\tchecking the type of the object" );
 
 # testing getattr()
-for my $i (0..2) {
-    $r = eval { $termios->getattr($i) };
-    is( $@, '', "calling getattr($i)" );
+
+SKIP: {
+    -t STDIN or skip("STDIN not a tty", 2);
+    $r = eval { $termios->getattr(0) };
+    is( $@, '', "calling getattr(0)" );
+    ok( defined $r, "\tchecking if the returned value is defined: $r" );
+}
+
+SKIP: {
+    -t STDOUT or skip("STDOUT not a tty", 2);
+    $r = eval { $termios->getattr(1) };
+    is( $@, '', "calling getattr(1)" );
+    ok( defined $r, "\tchecking if the returned value is defined: $r" );
+}
+
+SKIP: {
+    -t STDERR or skip("STDERR not a tty", 2);
+    $r = eval { $termios->getattr(2) };
+    is( $@, '', "calling getattr(2)" );
     ok( defined $r, "\tchecking if the returned value is defined: $r" );
 }