summaryrefslogtreecommitdiffstats
path: root/t/basic.t
diff options
context:
space:
mode:
Diffstat (limited to 't/basic.t')
-rw-r--r--t/basic.t32
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;