6 plan skip_all => "POSIX is unavailable"
7 if $Config{'extensions'} !~ m!\bPOSIX\b!;
12 plan skip_all => "POSIX::Termios not implemented"
13 if !eval "POSIX::Termios->new;1"
14 and $@=~/not implemented/;
18 my @getters = qw(getcflag getiflag getispeed getlflag getoflag getospeed);
20 plan tests => 3 + 2 * (3 + NCCS() + @getters);
25 my $termios = eval { POSIX::Termios->new };
26 is( $@, '', "calling POSIX::Termios->new" );
27 ok( defined $termios, "\tchecking if the object is defined" );
28 isa_ok( $termios, "POSIX::Termios", "\tchecking the type of the object" );
33 -t STDIN or skip("STDIN not a tty", 2);
34 $r = eval { $termios->getattr(0) };
35 is( $@, '', "calling getattr(0)" );
36 ok( defined $r, "\tchecking if the returned value is defined: $r" );
40 -t STDOUT or skip("STDOUT not a tty", 2);
41 $r = eval { $termios->getattr(1) };
42 is( $@, '', "calling getattr(1)" );
43 ok( defined $r, "\tchecking if the returned value is defined: $r" );
47 -t STDERR or skip("STDERR not a tty", 2);
48 $r = eval { $termios->getattr(2) };
49 is( $@, '', "calling getattr(2)" );
50 ok( defined $r, "\tchecking if the returned value is defined: $r" );
54 for my $i (0..NCCS()-1) {
55 $r = eval { $termios->getcc($i) };
56 is( $@, '', "calling getcc($i)" );
57 ok( defined $r, "\tchecking if the returned value is defined: $r" );
61 for my $method (@getters) {
62 $r = eval { $termios->$method() };
63 is( $@, '', "calling $method()" );
64 ok( defined $r, "\tchecking if the returned value is defined: $r" );