summaryrefslogtreecommitdiff
path: root/ext/POSIX
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-09-06 22:22:36 +0200
committerNicholas Clark <nick@ccl4.org>2011-09-13 11:28:05 +0200
commit8f8f11b514b019e5fda484221d756dd4d736b93b (patch)
tree0da429c0fd78a027326fd23f5b8dcbf79637cbe7 /ext/POSIX
parent65ac24840c5e485983a26fccd341a430fd869c5b (diff)
downloadperl-8f8f11b514b019e5fda484221d756dd4d736b93b.tar.gz
Add tests for POSIX::tc{drain,flow,flush,sendbreak}()
We don't want to mess with the user's terminal (as we might mess it up), so attempt to call each function on a disk file, and verify that it fails with ENOTTY.
Diffstat (limited to 'ext/POSIX')
-rw-r--r--ext/POSIX/t/termios.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/POSIX/t/termios.t b/ext/POSIX/t/termios.t
index bb0b5f1d50..380bee678b 100644
--- a/ext/POSIX/t/termios.t
+++ b/ext/POSIX/t/termios.t
@@ -158,4 +158,22 @@ if (defined $termios) {
}
+$! = 0;
+is(tcdrain(fileno $not_a_tty), undef, 'tcdrain on a non tty should fail');
+cmp_ok($!, '==', POSIX::ENOTTY, 'and set errno to ENOTTY');
+
+$! = 0;
+is(tcflow(fileno $not_a_tty, TCOON), undef, 'tcflow on a non tty should fail');
+cmp_ok($!, '==', POSIX::ENOTTY, 'and set errno to ENOTTY');
+
+$! = 0;
+is(tcflush(fileno $not_a_tty, TCOFLUSH), undef,
+ 'tcflush on a non tty should fail');
+cmp_ok($!, '==', POSIX::ENOTTY, 'and set errno to ENOTTY');
+
+$! = 0;
+is(tcsendbreak(fileno $not_a_tty, 0), undef,
+ 'tcsendbreak on a non tty should fail');
+cmp_ok($!, '==', POSIX::ENOTTY, 'and set errno to ENOTTY');
+
done_testing();