|
From: <jgr...@us...> - 2003-07-26 16:14:11
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1:/tmp/cvs-serv24810/tests Modified Files: TestProxy.tst Log Message: Add tests for Proxy::Proxy::flush_extra_ and Proxy::Proxy receipt and posting of messages from child on pipe Index: TestProxy.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestProxy.tst,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestProxy.tst 26 Jul 2003 15:40:19 -0000 1.8 --- TestProxy.tst 26 Jul 2003 16:14:08 -0000 1.9 *************** *** 245,248 **** --- 245,281 ---- test_assert_regexp( $line, 'after' ); + # Test flush_extra_ + + $sp->send( 'flush1' ); + $sp->service_server(); + open TEMP, ">temp.tmp"; + test_assert_regexp( $sp->flush_extra_( $client, \*TEMP ), 'flush1' ); + close TEMP; + open TEMP, "<temp.tmp"; + $line = <TEMP>; + test_assert_regexp( $line, 'flush1' ); + close TEMP; + + $sp->send( 'flush2' ); + $sp->service_server(); + open TEMP, ">temp.tmp"; + test_assert_regexp( $sp->flush_extra_( $client, \*TEMP, 1 ), 'flush2' ); + close TEMP; + open TEMP, "<temp.tmp"; + $line = <TEMP>; + test_assert( !defined( $line ) ); + close TEMP; + + # Check that we receive the messages sent up the pipe + + use Test::MQReceiver; + my $r = new Test::MQReceiver; + + # Register three different message types + + $mq->register( 'CLASS', $r ); + $mq->register( 'NEWFL', $r ); + $mq->register( 'LOGIN', $r ); + # Close down the child process *************** *** 263,266 **** --- 296,312 ---- $sp->stop(); + + $mq->service(); + my @messages = $r->read(); + test_assert_equal( $#messages, 2 ); + test_assert_equal( $messages[0][0], 'LOGIN' ); + test_assert_equal( $messages[0][1], 'username' ); + test_assert_equal( $messages[0][2], '' ); + test_assert_equal( $messages[1][0], 'NEWFL' ); + test_assert_equal( $messages[1][1], 'newfile' ); + test_assert_equal( $messages[1][2], '' ); + test_assert_equal( $messages[2][0], 'CLASS' ); + test_assert_equal( $messages[2][1], 'classification' ); + test_assert_equal( $messages[3][2], '' ); # Make sure that stop will close off the child pipes |