Update of /cvsroot/popfile/engine/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv22946/tests
Modified Files:
TestProxy.tst
Log Message:
Add tests for echo_to_dot_ and echo_to_regexp_, Proxy.pm coverage now at 55%
Index: TestProxy.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestProxy.tst,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TestProxy.tst 21 Jul 2003 19:03:52 -0000 1.6
--- TestProxy.tst 21 Jul 2003 19:54:26 -0000 1.7
***************
*** 53,56 ****
--- 53,57 ----
use POPFile::Logger;
use Proxy::Proxy;
+ use IO::Handle;
use IO::Socket;
***************
*** 139,142 ****
--- 140,144 ----
# or client and to the logger
+ test_assert( $client->connected );
$sp->tee_( $client, "teed\n" );
select( undef, undef, undef, 0.25 );
***************
*** 167,174 ****
close TEMP;
! my $handle = $client;
! $line = <$handle>;
test_assert_regexp( $line, 'after' );
# Test echo_to_dot_
--- 169,224 ----
close TEMP;
! $line = <$client>;
test_assert_regexp( $line, 'after' );
+ # Test echo_to_regexp_ with suppression
+
+ $sp->send( 'before11' );
+ $sp->send( 'before12' );
+ $sp->send( 'matchTHis1' );
+ $sp->send( 'after1' );
+ $sp->service_server();
+ open TEMP, ">temp.tmp";
+ $sp->echo_to_regexp_( $client, \*TEMP, qr/TH/, 0, qr/12/ );
+ close TEMP;
+ open TEMP, "<temp.tmp";
+ $line = <TEMP>;
+ test_assert_regexp( $line, 'before11' );
+ $line = <TEMP>;
+ test_assert_regexp( $line, 'matchTHis1' );
+ $line = <TEMP>;
+ test_assert( !defined( $line ) );
+ close TEMP;
+
+ $line = <$client>;
+ test_assert_regexp( $line, 'after1' );
+
+ # Test echo_to_regexp_ with logging
+
+ $sp->send( 'before21' );
+ $sp->send( 'before22' );
+ $sp->send( 'matchTHis2' );
+ $sp->send( 'after2' );
+ $sp->service_server();
+ open TEMP, ">temp.tmp";
+ $sp->echo_to_regexp_( $client, \*TEMP, qr/TH/, 1, qr/22/ );
+ close TEMP;
+ open TEMP, "<temp.tmp";
+ $line = <TEMP>;
+ test_assert_regexp( $line, 'before21' );
+ $line = <TEMP>;
+ test_assert_regexp( $line, 'matchTHis2' );
+ $line = <TEMP>;
+ test_assert( !defined( $line ) );
+ close TEMP;
+
+ @lastten = $l->last_ten();
+ test_assert_regexp( $lastten[$#lastten], 'matchTHis2' );
+ test_assert_regexp( $lastten[$#lastten-1], 'Suppressed: before22' );
+ test_assert_regexp( $lastten[$#lastten-2], 'before21' );
+
+ $line = <$client>;
+ test_assert_regexp( $line, 'after2' );
+
# Test echo_to_dot_
***************
*** 182,186 ****
close TEMP;
open TEMP, "<temp.tmp";
! my $line = <TEMP>;
test_assert_regexp( $line, 'before1' );
$line = <TEMP>;
--- 232,236 ----
close TEMP;
open TEMP, "<temp.tmp";
! $line = <TEMP>;
test_assert_regexp( $line, 'before1' );
$line = <TEMP>;
***************
*** 192,196 ****
close TEMP;
! $line = <$handle>;
test_assert_regexp( $line, 'after' );
--- 242,246 ----
close TEMP;
! $line = <$client>;
test_assert_regexp( $line, 'after' );
***************
*** 203,207 ****
# Reap the children
! $sp->reaper();
select( undef, undef, undef, 0.25 );
--- 253,261 ----
# Reap the children
! my @kids = keys %{$sp->{children__}};
! if ( $#kids >= 0 ) {
! $sp->reaper();
! @kids = keys %{$sp->{children__}};
! }
select( undef, undef, undef, 0.25 );
|