diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-03-07 02:21:48 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-03-07 02:22:11 -0600 |
commit | e1b070276d8c8beb0dcc76bc2c2ac070564e0c24 (patch) | |
tree | 374f819db920957ea47cfc59dffa2b824e3d1a59 /t | |
parent | 029d7083452d578ab264b9525e045d238187c511 (diff) | |
download | term-filter-e1b070276d8c8beb0dcc76bc2c2ac070564e0c24.tar.gz term-filter-e1b070276d8c8beb0dcc76bc2c2ac070564e0c24.zip |
make the test suite more reliable
Diffstat (limited to 't')
-rw-r--r-- | t/basic.t | 2 | ||||
-rw-r--r-- | t/callbacks.t | 9 | ||||
-rw-r--r-- | t/extra-pty.t | 7 | ||||
-rw-r--r-- | t/role.t | 9 |
4 files changed, 22 insertions, 5 deletions
@@ -18,7 +18,7 @@ SCRIPT my $crlf = "\x0d\x0a"; -$pty->spawn($^X, (map { "-I $_" } @INC), '-e', $script); +$pty->spawn($^X, (map {; '-I', $_ } @INC), '-e', $script); # just in case alarm 60; diff --git a/t/callbacks.t b/t/callbacks.t index cb99c18..250fec7 100644 --- a/t/callbacks.t +++ b/t/callbacks.t @@ -49,7 +49,7 @@ alarm 60; { my $pty = IO::Pty::Easy->new(handle_pty_size => 0); - $pty->spawn($^X, (map { "-I $_" } @INC), '-e', $script); + $pty->spawn($^X, (map {; '-I', $_ } @INC), '-e', $script); my $setup_str = full_read($pty); @@ -73,12 +73,19 @@ alarm 60; ^ MUNGE_INPUT: \s \Q$term_str\E \s \($ref\): \s fOo\n \n + (?: MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf \n foo$crlf MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf \n foo$crlf + | + MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf FOO$crlf + \n + foo$crlf + foo$crlf + ) $ }sx, "munge_input and munge_output got the right arguments" diff --git a/t/extra-pty.t b/t/extra-pty.t index d2e013a..8393f4f 100644 --- a/t/extra-pty.t +++ b/t/extra-pty.t @@ -70,7 +70,7 @@ alarm 60; { my $pty = IO::Pty::Easy->new(handle_pty_size => 0); - $pty->spawn($^X, (map { "-I $_" } @INC), '-e', $script); + $pty->spawn($^X, (map {; '-I', $_ } @INC), '-e', $script); open my $readfh, '>', $readp or die "can't open pipe (parent): $!"; @@ -87,7 +87,10 @@ alarm 60; sysread($writefh, $buf, 21); is($buf, "read from term: foo$crlf"); sysread($writefh, $buf, 21); - is($buf, "read from term: foo$crlf"); + # note that this could either happen as a second write, or as part + # of the first write (in which case, this read finishes reading + # the rest of the data that was sent previously) + like($buf, qr/^(?:read from term: )?foo\Q$crlf\E$/); } syswrite($readfh, "bar"); @@ -58,7 +58,7 @@ alarm 60; { my $pty = IO::Pty::Easy->new(handle_pty_size => 0); - $pty->spawn($^X, (map { "-I $_" } @INC), '-e', $script); + $pty->spawn($^X, (map {; '-I', $_ } @INC), '-e', $script); my $setup_str = full_read($pty); @@ -82,12 +82,19 @@ alarm 60; ^ MUNGE_INPUT: \s \Q$term_str\E \s \($ref\): \s fOo\n \n + (?: MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf \n foo$crlf MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf \n foo$crlf + | + MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf FOO$crlf + \n + foo$crlf + foo$crlf + ) $ }sx, "munge_input and munge_output got the right arguments" |