From fa633730412324b7f2b41f645da576e66462efa2 Mon Sep 17 00:00:00 2001 From: doy Date: Tue, 3 Feb 2009 02:35:18 -0500 Subject: add failing test --- t/100-system.t | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 t/100-system.t 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)"); -- cgit v1.2.3-54-g00ecf