From: John Graham-C. <jgr...@us...> - 2005-08-24 18:35:27
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8371/tests Modified Files: TestConfiguration.tst TestHistory.tst TestXMLRPC.tst Log Message: More v0.23.0 work. In this case around getting more parts of the test suite to work. *** POPFile/Database.pm: Replace INSERT with INSERT OR IGNORE statements. This surpresses the errors we were seeing with duplicate primary keys caused by the insertion of data from the schema file, followed by the insertion of data. The use of IGNORE also means that data inserted by the schema file will override old data. Making this change also causes the following tests to now pass: TestBayesScript, TestInsertScript. *** tests/TestConfiguration.tst Update tests for new global parameter GLOBAL_single_user. Fix a bug that was causing the command-line parser to erroneously complain about an empty -- command-line option. Changed the default options for Getopt::Long so that they are inline with the usage in POPFile/Loader.pm.TestConfiguration test suite now passes. *** POPFile/History.pm, tests/TestHistory.tst Fix minor oddity in History where the query used for searches had a LF in the middle of it (this was harmless but ugly). Update test suite so that start_query now gets a valid session. TestHistory suite now passes. *** Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS TestHistory PASS TestHTML fail (horribly) TestHTTP PASS TestIMAP PASS TestInsertScript PASS TestLogger PASS TestMailParse fail TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 fail TestProxy PASS TestWordMangle PASS TestXMLRPC fail TODO Why is there no TestDatabase? TestMailParse is failing on my machine because accented characters are not being recognized as part of the [:alpha:] character class. I have not fully understood why yet. Is any one else seeing this? Try running: print +(sort grep /[[:alpha:]]/, map { chr } 0..255), "\n"; To find out what [:alpha:] maps to. Index: TestConfiguration.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestConfiguration.tst,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** TestConfiguration.tst 4 Jan 2005 22:51:53 -0000 1.20 --- TestConfiguration.tst 24 Aug 2005 18:35:13 -0000 1.21 *************** *** 122,125 **** --- 122,127 ---- test_assert_regexp( $line, 'GLOBAL_msgdir messages/' ); $line = <FILE>; + test_assert_regexp( $line, 'GLOBAL_single_user 1' ); + $line = <FILE>; test_assert_regexp( $line, 'GLOBAL_timeout 60' ); $line = <FILE>; *************** *** 210,214 **** my $line = <OUTPUT>; close OUTPUT; ! test_assert_regexp( $line, 'Unknown option -config_foobar' ); @ARGV = ( '--', '-config_piddir', 'test4/' ); test_assert( $c->parse_command_line() ); --- 212,216 ---- my $line = <OUTPUT>; close OUTPUT; ! test_assert_regexp( $line, 'Unknown option: -config_foobar' ); @ARGV = ( '--', '-config_piddir', 'test4/' ); test_assert( $c->parse_command_line() ); *************** *** 219,225 **** close STDERR; open OUTPUT, "<stdout.tmp"; my $line = <OUTPUT>; close OUTPUT; ! test_assert_regexp( $line, 'Unknown option: doesnotexist' ); @ARGV = ( '--set', 'baz' ); open (STDERR, ">stdout.tmp"); --- 221,228 ---- close STDERR; open OUTPUT, "<stdout.tmp"; + <OUTPUT>; my $line = <OUTPUT>; close OUTPUT; ! test_assert_regexp( $line, 'Unknown option: --doesnotexist' ); @ARGV = ( '--set', 'baz' ); open (STDERR, ">stdout.tmp"); Index: TestHistory.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestHistory.tst,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TestHistory.tst 11 Jan 2005 07:53:11 -0000 1.14 --- TestHistory.tst 24 Aug 2005 18:35:13 -0000 1.15 *************** *** 52,55 **** --- 52,59 ---- $POPFile->CORE_start(); + my $l = $POPFile->get_module( 'POPFile/Logger' ); + $l->global_config_( 'debug', 1 ); + $l->config_( 'level', 2 ); + # Check the behaviour of reserve_slot. It should return a valid # number and create the associated path (but not the file), check *************** *** 247,251 **** my $session = $b->get_session_key( 'admin', '' ); $h->change_slot_classification( 1, 'spam', $session ); - $b->release_session_key( $session ); my @fields = $h->get_slot_fields( 1 ); --- 251,254 ---- *************** *** 268,272 **** # interface ! my $q = $h->start_query(); test_assert( defined( $q ) ); --- 271,275 ---- # interface ! my $q = $h->start_query( $session ); test_assert( defined( $q ) ); *************** *** 490,494 **** $h->cleanup_history(); ! my $qq = $h->start_query(); $h->set_query( $qq, '', '', '', 0 ); test_assert_equal( $h->get_query_size( $qq ), 0 ); --- 493,497 ---- $h->cleanup_history(); ! my $qq = $h->start_query( $session ); $h->set_query( $qq, '', '', '', 0 ); test_assert_equal( $h->get_query_size( $qq ), 0 ); *************** *** 503,506 **** --- 506,511 ---- test_assert( !( -e 'messages/00/00/00' ) ); + $b->release_session_key( $session ); + $POPFile->CORE_stop(); Index: TestXMLRPC.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestXMLRPC.tst,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestXMLRPC.tst 4 Jan 2005 22:52:10 -0000 1.8 --- TestXMLRPC.tst 24 Aug 2005 18:35:13 -0000 1.9 *************** *** 60,64 **** $x->config_( 'port', $xport ); if ($x->start() == 1) { - print "Running\n"; while ( $x->service() && $POPFile->CORE_service( 1 ) ) { select(undef,undef,undef, 0.1); --- 60,63 ---- *************** *** 76,80 **** use XMLRPC::Lite; ! print "Testing\n"; my $session = XMLRPC::Lite --- 75,79 ---- use XMLRPC::Lite; ! print "Testing $xport\n"; my $session = XMLRPC::Lite |