diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-03-05 02:09:28 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-03-05 02:09:28 -0600 |
commit | 906c4ab3946a60af6b843529c67da272bebdd95e (patch) | |
tree | 3c0bd2ed0acddd8849df79491fcaa8f42a053725 /t/basic.t | |
parent | 27c6207e93506110f9af8e3c03c6687ea44a4fea (diff) | |
download | term-filter-906c4ab3946a60af6b843529c67da272bebdd95e.tar.gz term-filter-906c4ab3946a60af6b843529c67da272bebdd95e.zip |
basic test
Diffstat (limited to 't/basic.t')
-rw-r--r-- | t/basic.t | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..c1963ef --- /dev/null +++ b/t/basic.t @@ -0,0 +1,32 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use IO::Pty::Easy; + +my $pty = IO::Pty::Easy->new(handle_pty_size => 0); + +my $script = <<'SCRIPT'; +use Term::Filter; +my $term = Term::Filter->new; +$term->run($^X, '-ple', q[last if /^$/]); +print "done\n"; +SCRIPT + +my $crlf = "\x0d\x0a"; + +$pty->spawn($^X, '-Ilib', '-e', $script); +$pty->write("foo\n"); +is($pty->read(undef, 5), "foo$crlf"); +is($pty->read(undef, 5), "foo$crlf"); +$pty->write("bar\nbaz\n"); +is($pty->read(undef, 5), "bar$crlf"); +is($pty->read(undef, 5), "baz$crlf"); +is($pty->read(undef, 5), "bar$crlf"); +is($pty->read(undef, 5), "baz$crlf"); +$pty->write("\n"); +is($pty->read(undef, 2), "$crlf"); +is($pty->read(undef, 6), "done\n"); + +done_testing; |