summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-07-11 00:34:09 -0500
committerJesse Luehrs <doy@tozt.net>2009-07-11 00:34:09 -0500
commitca3774181b7cef62b4dcc40ed03d92b43aab47ca (patch)
tree35aa61e02f881c9cbcca8e2a0139240ec9b66d48 /t
parent6f110be148506fb3d86be84e2acba7cf932c58dd (diff)
downloadapp-termcast-ca3774181b7cef62b4dcc40ed03d92b43aab47ca.tar.gz
app-termcast-ca3774181b7cef62b4dcc40ed03d92b43aab47ca.zip
add the beginnings of a test
Diffstat (limited to 't')
-rw-r--r--t/001-basic.t31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/001-basic.t b/t/001-basic.t
new file mode 100644
index 0000000..a8867a9
--- /dev/null
+++ b/t/001-basic.t
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use App::Termcast;
+BEGIN {
+ eval "use Test::TCP;";
+ plan skip_all => "Test::TCP is required for this test" if $@;
+ plan tests => 1;
+}
+
+test_tcp(
+ client => sub {
+ my $port = shift;
+ my $tc = App::Termcast->new(host => '127.0.0.1', port => $port,
+ user => 'test', password => 'tset',
+ extra_argv => ["$^X", "-e", "print 'foo'"]);
+ $tc->run;
+ },
+ server => sub {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(LocalAddr => '127.0.0.1',
+ LocalPort => $port,
+ Listen => 1);
+ $sock->accept;
+ my $client = $sock->accept;
+ my $login;
+ $client->recv($login, 4096);
+ is($login, "hello test tset\n", 'got the correct login info');
+ },
+);