|
From: <jgr...@us...> - 2003-07-12 05:59:05
|
Update of /cvsroot/popfile/engine/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv19533/tests
Modified Files:
TestConfiguration.tst
Log Message:
Test suite now has 100% coverage for Configuration meaning that all the POPFile/ modules have 100% coverage... moving on to other modules now
Index: TestConfiguration.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestConfiguration.tst,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TestConfiguration.tst 10 Jul 2003 04:28:16 -0000 1.1
--- TestConfiguration.tst 12 Jul 2003 05:59:02 -0000 1.2
***************
*** 61,66 ****
--- 61,140 ----
close PIDFILE;
test_assert_equal( $pid, $$ );
+ open (STDERR, ">stdout.tmp");
+ test_assert_equal( $c->start(), 0 );
+ close STDERR;
$c->stop();
test_assert( !( -e 'tests/popfile.pid' ) );
+ # Check that parameter upgrading works
+
+ my %upgrades = ( 'corpus', 'bayes_corpus',
+ 'unclassified_probability', 'bayes_unclassified_probability',
+ 'piddir', 'config_piddir',
+ 'debug', 'GLOBAL_debug',
+ 'msgdir', 'GLOBAL_msgdir',
+ 'subject', 'GLOBAL_subject',
+ 'timeout', 'GLOBAL_timeout',
+ 'xpl', 'GLOBAL_xpl',
+ 'xtc', 'GLOBAL_xtc',
+ 'download_count', 'GLOBAL_download_count',
+ 'logdir', 'logger_logdir',
+ 'localpop', 'pop3_local',
+ 'port', 'pop3_port',
+ 'sport', 'pop3_secure_port',
+ 'server', 'pop3_secure_server',
+ 'separator', 'pop3_separator',
+ 'toptoo', 'pop3_toptoo',
+ 'archive', 'html_archive',
+ 'archive_classes', 'html_archive_classes',
+ 'archive_dir', 'html_archive_dir',
+ 'history_days', 'html_history_days',
+ 'language', 'html_language',
+ 'last_reset', 'html_last_reset',
+ 'last_update_check', 'html_last_update_check',
+ 'localui', 'html_local',
+ 'page_size', 'html_page_size',
+ 'password', 'html_password',
+ 'send_stats', 'html_send_stats',
+ 'skin', 'html_skin',
+ 'test_language', 'html_test_language',
+ 'update_check', 'html_update_check',
+ 'ui_port', 'html_port' );
+
+ foreach my $param (sort keys %upgrades) {
+ test_assert_equal( $upgrades{$param}, $c->upgrade_parameter__( $param ) );
+ }
+
+ test_assert_equal( 'random', $c->upgrade_parameter__( 'random' ) );
+
+ # Check command line parsing
+ @ARGV = ( '-config_piddir', 'test2/' );
+ $c->parse_command_line();
+ test_assert_equal( $c->module_config_( 'config', 'piddir' ), 'test2/' );
+ @ARGV = ( 'config_piddir', 'test3/' );
+ open (STDERR, ">stdout.tmp");
+ $c->parse_command_line();
+ close STDERR;
+ open OUTPUT, "<stdout.tmp";
+ my $line = <OUTPUT>;
+ close OUTPUT;
+ test_assert_regexp( $line, 'Expected a command line option and got config_piddir' );
+ test_assert_equal( $c->module_config_( 'config', 'piddir' ), 'test2/' );
+ @ARGV = ( '-config_piddir' );
+ open (STDERR, ">stdout.tmp");
+ $c->parse_command_line();
+ close STDERR;
+ open OUTPUT, "<stdout.tmp";
+ my $line = <OUTPUT>;
+ close OUTPUT;
+ test_assert_regexp( $line, 'Missing argument for -config_piddir' );
+ test_assert_equal( $c->module_config_( 'config', 'piddir' ), 'test2/' );
+ @ARGV = ( '-config_foobar' );
+ open (STDERR, ">stdout.tmp");
+ $c->parse_command_line();
+ close STDERR;
+ open OUTPUT, "<stdout.tmp";
+ my $line = <OUTPUT>;
+ close OUTPUT;
+ test_assert_regexp( $line, 'Unknown command line option -config_foobar' );
|