From: Manni H. <man...@us...> - 2007-12-01 18:02:16
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13604/tests Modified Files: Tag: b0_22_2 TestIMAP.tst Makefile Log Message: Add a new target for the Makefile: cover This will use Devel::Cover to produce the coverage report which is a bit more helpful than our TestCoverage. Fix a bug in the IMAP tests I would never have found without Devel::Cover. Index: TestIMAP.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestIMAP.tst,v retrieving revision 1.3.4.11 retrieving revision 1.3.4.12 diff -C2 -d -r1.3.4.11 -r1.3.4.12 *** TestIMAP.tst 30 Nov 2007 21:13:39 -0000 1.3.4.11 --- TestIMAP.tst 1 Dec 2007 18:02:19 -0000 1.3.4.12 *************** *** 93,96 **** --- 93,104 ---- test_assert( $im->start() ); + # The module is not supposed to do anything when the update + # interval hasn't elapsed yet: + my $last_update = time - 2; + $im->{last_update__} = $last_update; + $im->service(); + test_assert_equal( $im->{last_update__}, $last_update ); + $im->{last_update__} = 0; + # Login. The server doesn't have any messages for us yet $im->log_( 0, "---- testing login to empty server (uidnext and uidvalidity)" ); *************** *** 98,101 **** --- 106,111 ---- $im->service(); + test_assert_equal( $im->{last_update__}, time ); + foreach my $folder (qw/ INBOX personal spam other / ) { my $client = $im->{folders__}{$folder}{imap}; *************** *** 692,696 **** $im->config_( 'hostname', '127.0.0.1' ); $im->config_( 'password', 'password' ); ! $im->config_( 'username', 'someone' ); $im->config_( 'port', '1143' ); $im->config_( 'update_interval', 10 ); --- 702,706 ---- $im->config_( 'hostname', '127.0.0.1' ); $im->config_( 'password', 'password' ); ! $im->config_( 'login', 'someone' ); $im->config_( 'port', '1143' ); $im->config_( 'update_interval', 10 ); *************** *** 700,704 **** --- 710,716 ---- test_assert( ! $tmpl->param( 'IMAP_update_list_failed' ) ); + $im->config_( 'login', 'someone' ); $im->config_( 'hostname', '' ); + $tmpl = HTML::Template->new( filename => '../skins/default/imap-update-mailbox-list.thtml' ); $im->validate_item( 'imap_4_update_mailbox_list', $tmpl, $language, $form ); test_assert( $tmpl->param( 'IMAP_update_list_failed' ) ); *************** *** 706,714 **** $im->config_( 'hostname', '127.0.0.1' ); $im->config_( 'port', '12345' ); $im->validate_item( 'imap_4_update_mailbox_list', $tmpl, $language, $form ); test_assert( $tmpl->param( 'IMAP_update_list_failed' ) ); $im->config_( 'port', 1143 ); ! $im->config_( 'username', 'fail' ); $im->validate_item( 'imap_4_update_mailbox_list', $tmpl, $language, $form ); test_assert( $tmpl->param( 'IMAP_update_list_failed' ) ); --- 718,728 ---- $im->config_( 'hostname', '127.0.0.1' ); $im->config_( 'port', '12345' ); + $tmpl = HTML::Template->new( filename => '../skins/default/imap-update-mailbox-list.thtml' ); $im->validate_item( 'imap_4_update_mailbox_list', $tmpl, $language, $form ); test_assert( $tmpl->param( 'IMAP_update_list_failed' ) ); $im->config_( 'port', 1143 ); ! $im->config_( 'login', 'fail' ); ! $tmpl = HTML::Template->new( filename => '../skins/default/imap-update-mailbox-list.thtml' ); $im->validate_item( 'imap_4_update_mailbox_list', $tmpl, $language, $form ); test_assert( $tmpl->param( 'IMAP_update_list_failed' ) ); *************** *** 748,751 **** --- 762,768 ---- $im->history ( $h ); $im->initialize(); + # We should not do anything when we're not enabled: + $im->config_( 'enabled', 0 ); + test_assert_equal( $im->start(), 2 ); $im->config_( 'enabled', 1 ); $im->config_( 'expunge', 1 ); Index: Makefile =================================================================== RCS file: /cvsroot/popfile/engine/tests/Makefile,v retrieving revision 1.11.8.1 retrieving revision 1.11.8.2 diff -C2 -d -r1.11.8.1 -r1.11.8.2 *** Makefile 6 Feb 2006 15:19:10 -0000 1.11.8.1 --- Makefile 1 Dec 2007 18:02:19 -0000 1.11.8.2 *************** *** 29,36 **** runtest: ! @perl -I ../ $(DEBUGARGS) ../tests.pl $(TESTARGS) ifdef DEBUGARGS @perl ../coverage.pl endif @rm -rf corpus @rm -rf messages --- 29,39 ---- runtest: ! @perl -I ../ $(DEBUGARGS) $(COVERARGS) ../tests.pl $(TESTARGS) ifdef DEBUGARGS @perl ../coverage.pl endif + ifdef COVERARGS + cover -report html cover_db + endif @rm -rf corpus @rm -rf messages |