From 906c4ab3946a60af6b843529c67da272bebdd95e Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 5 Mar 2012 02:09:28 -0600 Subject: basic test --- t/basic.t | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 t/basic.t 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; -- cgit v1.2.3-54-g00ecf