From 1db37bb0163fbb33801f8f66ba409a8202137508 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 14 Apr 2011 08:52:04 -0500 Subject: override termsize calculation in tests, so it is consistent --- t/01-basic.t | 10 ++++++++-- t/02-read-write.t | 10 ++++++++-- t/03-write-to-termcast.t | 9 +++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) (limited to 't') diff --git a/t/01-basic.t b/t/01-basic.t index d3ae485..bf85edb 100644 --- a/t/01-basic.t +++ b/t/01-basic.t @@ -20,6 +20,11 @@ test_tcp( my $client_script = <new(host => '127.0.0.1', port => $port, user => 'test', password => 'tset'); \$tc->run('$^X', "-e", "print 'foo'"); @@ -43,8 +48,9 @@ EOF { sysread($sread, my $buf, 1) } my $login; $client->recv($login, 4096); - my $auth_regexp = qr/^hello test tset\n(?:\e\[H\x00.+?\xff\e\[H\e\[2J)?/; - like($login, $auth_regexp, 'got the correct login info'); + is($login, + "hello test tset\n\e\[H\x00{\"geometry\":[80,24]}\xff\e\[H\e\[2J", + "got the correct login info"); $client->send("hello, test\n"); my $output; $client->recv($output, 4096); diff --git a/t/02-read-write.t b/t/02-read-write.t index b7a26ac..0979955 100644 --- a/t/02-read-write.t +++ b/t/02-read-write.t @@ -20,6 +20,11 @@ test_tcp( my $client_script = <new( host => '127.0.0.1', port => $port, user => 'test', password => 'tset'); @@ -69,8 +74,9 @@ EOF { sysread($sread, my $buf, 1) } my $login; $client->recv($login, 4096); - my $auth_regexp = qr/^hello test tset\n(?:\e\[H\x00.+?\xff\e\[H\e\[2J)?/; - like($login, $auth_regexp, 'got the correct login info'); + is($login, + "hello test tset\n\e\[H\x00{\"geometry\":[80,24]}\xff\e\[H\e\[2J", + "got the correct login info"); $client->send("hello, test\n"); syswrite($swrite, 'a'); diff --git a/t/03-write-to-termcast.t b/t/03-write-to-termcast.t index 5b7c4b2..47321ec 100644 --- a/t/03-write-to-termcast.t +++ b/t/03-write-to-termcast.t @@ -6,6 +6,10 @@ use Test::Requires 'Test::TCP'; use App::Termcast; +no warnings 'redefine'; +local *App::Termcast::_termsize = sub { return (80, 24) }; +use warnings 'redefine'; + pipe(my $cread, my $swrite); pipe(my $sread, my $cwrite); @@ -36,8 +40,9 @@ test_tcp( my $client = $sock->accept; my $login; $client->recv($login, 4096); - my $auth_regexp = qr/^hello test tset\n(?:\e\[H\x00.+?\xff\e\[H\e\[2J)?/; - like($login, $auth_regexp, 'got the correct login info'); + is($login, + "hello test tset\n\e\[H\x00{\"geometry\":[80,24]}\xff\e\[H\e\[2J", + "got the correct login info"); $client->send("hello, test\n"); { sysread($sread, my $buf, 1) } -- cgit v1.2.3-54-g00ecf