summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-02-03 02:35:18 -0500
committerdoy <doy@tozt.net>2009-02-03 02:35:18 -0500
commitfa633730412324b7f2b41f645da576e66462efa2 (patch)
tree1b35368e3d682e18f7ef4d1bf62189b2fc2e03e1
parent66456c28a0180d26b6aa81d917ebdc0d7aa2a4cb (diff)
downloadio-pty-easy-fa633730412324b7f2b41f645da576e66462efa2.tar.gz
io-pty-easy-fa633730412324b7f2b41f645da576e66462efa2.zip
add failing test
-rw-r--r--t/100-system.t30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/100-system.t b/t/100-system.t
new file mode 100644
index 0000000..5c64156
--- /dev/null
+++ b/t/100-system.t
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 4;
+use IO::Pty::Easy;
+
+my $pty = IO::Pty::Easy->new;
+$pty->spawn("$^X -ple ''");
+my $output;
+TODO: {
+ local $TODO = "sigchld breaks things...";
+ eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ alarm 5;
+ $output = `$^X -e 'print "foo"'`;
+ alarm 0;
+ };
+ isnt($@, "alarm\n", "system() didn't time out");
+ is($output, "foo", "system() got the right value");
+}
+$pty->kill;
+undef $output;
+eval {
+ local $SIG{ALRM} = sub { die "alarm2\n" };
+ alarm 5;
+ $output = `$^X -e 'print "bar"'`;
+ alarm 0;
+};
+isnt($@, "alarm2\n", "system() didn't time out (after kill)");
+is($output, "bar", "system() got the right value (after kill)");