From: naoki i. <am...@us...> - 2008-04-28 11:49:25
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7400/tests Modified Files: TestBayes.tst TestBayesScript.tst TestHTML.tst TestIMAP.tst TestInsertScript.tst TestMailParse.tst TestPOP3.tst TestPipeScript.tst Log Message: * Clean up the tests directory and move messages and their accompanying .cam, .cls, etc. files to the new subdirectory 'TestMails'. * Change all tests to reflect this change. Index: TestHTML.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestHTML.tst,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** TestHTML.tst 28 Apr 2008 11:17:43 -0000 1.40 --- TestHTML.tst 28 Apr 2008 11:48:59 -0000 1.41 *************** *** 56,60 **** mkdir 'messages'; ! my @messages = glob 'TestMailParse*.msg'; my $count = 0; --- 56,60 ---- mkdir 'messages'; ! my @messages = glob 'TestMails/TestMailParse*.msg'; my $count = 0; Index: TestInsertScript.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestInsertScript.tst,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TestInsertScript.tst 9 Apr 2008 17:20:48 -0000 1.9 --- TestInsertScript.tst 28 Apr 2008 11:48:59 -0000 1.10 *************** *** 58,62 **** open STDERR, ">temp.tmp"; ! system("$insert none TestMailParse021.wrd"); close STDERR; $code = ($? >> 8); --- 58,62 ---- open STDERR, ">temp.tmp"; ! system("$insert none TestMails/TestMailParse021.wrd"); close STDERR; $code = ($? >> 8); *************** *** 85,89 **** my %words; ! open WORDS, "<TestMailParse021.wrd"; while ( <WORDS> ) { if ( /(.+) (\d+)/ ) { --- 85,89 ---- my %words; ! open WORDS, "<TestMails/TestMailParse021.wrd"; while ( <WORDS> ) { if ( /(.+) (\d+)/ ) { *************** *** 94,98 **** open STDERR, ">temp.tmp"; ! @stdout =`$insert personal TestMailParse021.msg`; $code = ($? >> 8); close STDERR; --- 94,98 ---- open STDERR, ">temp.tmp"; ! @stdout =`$insert personal TestMails/TestMailParse021.msg`; $code = ($? >> 8); close STDERR; Index: TestPipeScript.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestPipeScript.tst,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TestPipeScript.tst 20 Feb 2006 02:20:57 -0000 1.9 --- TestPipeScript.tst 28 Apr 2008 11:48:59 -0000 1.10 *************** *** 51,57 **** # Try classifying a message ! my $modify_file = 'TestMailParse021.msg'; ! $code = system( "cat TestMailParse021.msg | $pipe > temp.tmp" ); # Done once to force the bucket upgrade ! $code = system( "cat TestMailParse021.msg | $pipe > temp.tmp" ); test_assert( $code == 0 ); my $output_file = $modify_file; --- 51,57 ---- # Try classifying a message ! my $modify_file = 'TestMails/TestMailParse021.msg'; ! $code = system( "cat TestMails/TestMailParse021.msg | $pipe > temp.tmp" ); # Done once to force the bucket upgrade ! $code = system( "cat TestMails/TestMailParse021.msg | $pipe > temp.tmp" ); test_assert( $code == 0 ); my $output_file = $modify_file; Index: TestIMAP.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestIMAP.tst,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TestIMAP.tst 10 Apr 2008 15:17:35 -0000 1.13 --- TestIMAP.tst 28 Apr 2008 11:48:59 -0000 1.14 *************** *** 195,199 **** # check that a fresh classification confirms the reclassification ! test_assert_equal( $b->classify( $session, 'TestMailParse007.msg' ), 'personal' ); # Now let's see whether the words in one of the reclassified messages --- 195,199 ---- # check that a fresh classification confirms the reclassification ! test_assert_equal( $b->classify( $session, 'TestMails/TestMailParse007.msg' ), 'personal' ); # Now let's see whether the words in one of the reclassified messages *************** *** 202,206 **** my %words; ! open WORDS, "<TestMailParse013.wrd"; while ( <WORDS> ) { if ( /(.+) (\d+)/ ) { --- 202,206 ---- my %words; ! open WORDS, "<TestMails/TestMailParse013.wrd"; while ( <WORDS> ) { if ( /(.+) (\d+)/ ) { *************** *** 345,349 **** my ( $ok, @msg_lines ) = $client->fetch_message_part( $uid, '' ); test_assert_equal( $ok, 1 ); ! my $filename = "TestMailParse$msg_number.msg"; if ( open my $ORG, '<', $filename ) { my @org_lines = (); --- 345,349 ---- my ( $ok, @msg_lines ) = $client->fetch_message_part( $uid, '' ); test_assert_equal( $ok, 1 ); ! my $filename = "TestMails/TestMailParse$msg_number.msg"; if ( open my $ORG, '<', $filename ) { my @org_lines = (); Index: TestBayesScript.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestBayesScript.tst,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestBayesScript.tst 9 Apr 2008 17:20:48 -0000 1.8 --- TestBayesScript.tst 28 Apr 2008 11:48:59 -0000 1.9 *************** *** 68,72 **** my %words; ! open WORDS, "<TestMailParse021.wrd"; while ( <WORDS> ) { if ( /(.+) (\d+)/ ) { --- 68,72 ---- my %words; ! open WORDS, "<TestMails/TestMailParse021.wrd"; while ( <WORDS> ) { if ( /(.+) (\d+)/ ) { *************** *** 76,85 **** close WORDS; ! @stdout = `$bayes TestMailParse021.msg`;# 2> temp.tmp 1> temp2.tmp" ); $code = ($? >> 8); test_assert( $code == 0 ); $line = shift @stdout; ! test_assert_regexp( $line, '`TestMailParse021.msg\' is `spam\'' ); my %output; --- 76,85 ---- close WORDS; ! @stdout = `$bayes TestMails/TestMailParse021.msg`;# 2> temp.tmp 1> temp2.tmp" ); $code = ($? >> 8); test_assert( $code == 0 ); $line = shift @stdout; ! test_assert_regexp( $line, '`TestMails/TestMailParse021.msg\' is `spam\'' ); my %output; Index: TestMailParse.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestMailParse.tst,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** TestMailParse.tst 9 Apr 2008 17:20:48 -0000 1.48 --- TestMailParse.tst 28 Apr 2008 11:48:59 -0000 1.49 *************** *** 332,337 **** $cl->update_tag( "faketag(|", "foo", 1, 0 ); ! # glob the tests directory for files called TestMailParse\d+.msg which consist of messages ! # to be parsed with the resulting values for the words hash in TestMailParse\d+.wrd # Since the [[:alpha:]] regular expression is affected by the system locale, fix the --- 332,337 ---- $cl->update_tag( "faketag(|", "foo", 1, 0 ); ! # glob the tests directory for files called TestMails/TestMailParse\d+.msg which consist of messages ! # to be parsed with the resulting values for the words hash in TestMails/TestMailParse\d+.wrd # Since the [[:alpha:]] regular expression is affected by the system locale, fix the *************** *** 342,346 **** setlocale( LC_CTYPE, 'C' ); ! my @parse_tests = sort glob 'TestMailParse*.msg'; for my $parse_test (@parse_tests) { --- 342,346 ---- setlocale( LC_CTYPE, 'C' ); ! my @parse_tests = sort glob 'TestMails/TestMailParse*.msg'; for my $parse_test (@parse_tests) { *************** *** 381,397 **** # Check that from, to and subject get set correctly when parsing a message ! $cl->parse_file( 'TestMailParse013.msg' ); test_assert_equal( $cl->{from__}, 'RN <rr...@nn...>' ); test_assert_equal( $cl->{to__}, '"Armlet Forum" <arm...@ne...>' ); test_assert_equal( $cl->{subject__}, '(Archive Copy) RE: CW v9 and armlets...' ); ! $cl->parse_file( 'TestMailParse018.msg' ); $cl->{to__} =~ /(\Qbugtracker\E@\Qrltvty.com\E)/; test_assert_equal( $1, 'bug...@rl...' ); ! $cl->parse_file( 'TestMailParse019.msg' ); $cl->{to__} =~ /(\Qbugtracker\E@\Qrltvty.com\E)/; test_assert_equal( $1, 'bug...@rl...' ); # Check that multi-line To: and CC: headers get handled properly ! $cl->parse_file( 'TestMailParse021.msg' ); #$cl->{to__} =~ s/[\r\n]//g; test_assert_equal( $cl->{to__}, 'ds...@ct..., ds...@do..., ds...@di..., ds...@di..., ds...@cr...,<ds...@cy...>, <ds...@do...>, <ds...@db...>, <ds...@cs...>, <ds...@cr...>,<ds...@dr...>, <ds...@cv...>, <ds...@dm...>, <ds...@da...>,<ds...@da...>' ); --- 381,397 ---- # Check that from, to and subject get set correctly when parsing a message ! $cl->parse_file( 'TestMails/TestMailParse013.msg' ); test_assert_equal( $cl->{from__}, 'RN <rr...@nn...>' ); test_assert_equal( $cl->{to__}, '"Armlet Forum" <arm...@ne...>' ); test_assert_equal( $cl->{subject__}, '(Archive Copy) RE: CW v9 and armlets...' ); ! $cl->parse_file( 'TestMails/TestMailParse018.msg' ); $cl->{to__} =~ /(\Qbugtracker\E@\Qrltvty.com\E)/; test_assert_equal( $1, 'bug...@rl...' ); ! $cl->parse_file( 'TestMails/TestMailParse019.msg' ); $cl->{to__} =~ /(\Qbugtracker\E@\Qrltvty.com\E)/; test_assert_equal( $1, 'bug...@rl...' ); # Check that multi-line To: and CC: headers get handled properly ! $cl->parse_file( 'TestMails/TestMailParse021.msg' ); #$cl->{to__} =~ s/[\r\n]//g; test_assert_equal( $cl->{to__}, 'ds...@ct..., ds...@do..., ds...@di..., ds...@di..., ds...@cr...,<ds...@cy...>, <ds...@do...>, <ds...@db...>, <ds...@cs...>, <ds...@cr...>,<ds...@dr...>, <ds...@cv...>, <ds...@dm...>, <ds...@da...>,<ds...@da...>' ); *************** *** 401,405 **** # Test colorization ! my @color_tests = ( 'TestMailParse015.msg', 'TestMailParse019.msg' ); my $b = $POPFile->get_module( 'Classifier/Bayes' ); --- 401,405 ---- # Test colorization ! my @color_tests = ( 'TestMails/TestMailParse015.msg', 'TestMails/TestMailParse019.msg' ); my $b = $POPFile->get_module( 'Classifier/Bayes' ); *************** *** 447,451 **** # test get_header ! $cl->parse_file( 'TestMailParse022.msg' ); test_assert_equal( $cl->get_header( 'from' ), 'te...@te...' ); test_assert_equal( $cl->get_header( 'to' ), 'so...@so...' ); --- 447,451 ---- # test get_header ! $cl->parse_file( 'TestMails/TestMailParse022.msg' ); test_assert_equal( $cl->get_header( 'from' ), 'te...@te...' ); test_assert_equal( $cl->get_header( 'to' ), 'so...@so...' ); *************** *** 479,485 **** # test first20 ! $cl->parse_file( 'TestMailParse022.msg' ); test_assert_equal( $cl->first20(), ' This is the title image tag ALT string' ); ! $cl->parse_file( 'TestMailParse021.msg' ); test_assert_equal( $cl->first20(), ' Take Control of Your Computer With This Top of the Line Software Norton SystemWorks Software Suite Professional Edition Includes Six' ); --- 479,485 ---- # test first20 ! $cl->parse_file( 'TestMails/TestMailParse022.msg' ); test_assert_equal( $cl->first20(), ' This is the title image tag ALT string' ); ! $cl->parse_file( 'TestMails/TestMailParse021.msg' ); test_assert_equal( $cl->first20(), ' Take Control of Your Computer With This Top of the Line Software Norton SystemWorks Software Suite Professional Edition Includes Six' ); Index: TestPOP3.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestPOP3.tst,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** TestPOP3.tst 28 Apr 2008 11:17:43 -0000 1.38 --- TestPOP3.tst 28 Apr 2008 11:48:59 -0000 1.39 *************** *** 675,679 **** my $count = 0; my $size = 0; ! my @messages = sort glob 'TestMailParse*.msg'; for my $i (0..$#messages) { if ( $messages[$i] ne '' ) { --- 675,679 ---- my $count = 0; my $size = 0; ! my @messages = sort glob 'TestMails/TestMailParse*.msg'; for my $i (0..$#messages) { if ( $messages[$i] ne '' ) { *************** *** 790,794 **** $cam =~ s/msg$/cam/; ! test_assert( open RESULT, ">testpop3_$messages[27]-got.cam" ); test_assert( open FILE, "<$cam" ); binmode FILE; --- 790,794 ---- $cam =~ s/msg$/cam/; ! test_assert( open RESULT, ">$messages[27]_testpop3_-got.cam" ); test_assert( open FILE, "<$cam" ); binmode FILE; *************** *** 2176,2180 **** { my ( $client, $apop ) = @_; ! my @messages = sort glob 'TestMailParse*.msg'; my $goslow = 0; my $hang = 0; --- 2176,2180 ---- { my ( $client, $apop ) = @_; ! my @messages = sort glob 'TestMails/TestMailParse*.msg'; my $goslow = 0; my $hang = 0; *************** *** 2294,2298 **** if ( $command =~ /RSET/i ) { ! @messages = sort glob 'TestMailParse*.msg'; print $client "+OK Reset$eol"; next; --- 2294,2298 ---- if ( $command =~ /RSET/i ) { ! @messages = sort glob 'TestMails/TestMailParse*.msg'; print $client "+OK Reset$eol"; next; Index: TestBayes.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestBayes.tst,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** TestBayes.tst 28 Apr 2008 11:17:43 -0000 1.66 --- TestBayes.tst 28 Apr 2008 11:48:59 -0000 1.67 *************** *** 620,625 **** # get_html_colored_message ! my $html = $b->get_html_colored_message( $session, 'TestMailParse019.msg' ); ! open FILE, "<TestMailParse019.clr"; my $check = <FILE>; close FILE; --- 620,625 ---- # get_html_colored_message ! my $html = $b->get_html_colored_message( $session, 'TestMails/TestMailParse019.msg' ); ! open FILE, "<TestMails/TestMailParse019.clr"; my $check = <FILE>; close FILE; *************** *** 684,688 **** my %words; ! open WORDS, "<TestMailParse021.wrd"; while ( <WORDS> ) { if ( /(.+) (\d+)/ ) { --- 684,688 ---- my %words; ! open WORDS, "<TestMails/TestMailParse021.wrd"; while ( <WORDS> ) { if ( /(.+) (\d+)/ ) { *************** *** 692,696 **** close WORDS; ! test_assert( $b->add_message_to_bucket( $session, 'zeotrope', 'TestMailParse021.msg' ) ); foreach my $word (keys %words) { --- 692,696 ---- close WORDS; ! test_assert( $b->add_message_to_bucket( $session, 'zeotrope', 'TestMails/TestMailParse021.msg' ) ); foreach my $word (keys %words) { *************** *** 698,702 **** } ! test_assert( $b->add_message_to_bucket( $session, 'zeotrope', 'TestMailParse021.msg' ) ); foreach my $word (keys %words) { --- 698,702 ---- } ! test_assert( $b->add_message_to_bucket( $session, 'zeotrope', 'TestMails/TestMailParse021.msg' ) ); foreach my $word (keys %words) { *************** *** 706,711 **** # remove_message_from_bucket ! test_assert( $b->remove_message_from_bucket( $session, 'zeotrope', 'TestMailParse021.msg' ) ); ! test_assert( $b->remove_message_from_bucket( $session, 'zeotrope', 'TestMailParse021.msg' ) ); test_assert_equal( $b->get_bucket_word_count( $session, 'zeotrope' ), 0 ); --- 706,711 ---- # remove_message_from_bucket ! test_assert( $b->remove_message_from_bucket( $session, 'zeotrope', 'TestMails/TestMailParse021.msg' ) ); ! test_assert( $b->remove_message_from_bucket( $session, 'zeotrope', 'TestMails/TestMailParse021.msg' ) ); test_assert_equal( $b->get_bucket_word_count( $session, 'zeotrope' ), 0 ); *************** *** 714,718 **** # add_messages_to_bucket ! test_assert( $b->add_messages_to_bucket( $session, 'zeotrope', ( 'TestMailParse021.msg', 'TestMailParse021.msg' ) ) ); foreach my $word (keys %words) { --- 714,718 ---- # add_messages_to_bucket ! test_assert( $b->add_messages_to_bucket( $session, 'zeotrope', ( 'TestMails/TestMailParse021.msg', 'TestMails/TestMailParse021.msg' ) ) ); foreach my $word (keys %words) { *************** *** 918,922 **** $b->create_magnet( $session, 'zeotrope', 'from', 'cxc...@ya...' ); ! test_assert_equal( $b->classify( $session, 'TestMailParse021.msg' ), 'zeotrope' ); test_assert_equal( $b->{magnet_detail__}, 8 ); test_assert( $b->{magnet_used__} ); --- 918,922 ---- $b->create_magnet( $session, 'zeotrope', 'from', 'cxc...@ya...' ); ! test_assert_equal( $b->classify( $session, 'TestMails/TestMailParse021.msg' ), 'zeotrope' ); test_assert_equal( $b->{magnet_detail__}, 8 ); test_assert( $b->{magnet_used__} ); *************** *** 960,967 **** test_assert_equal( $b->get_sort_value_( $session, 'personal', 'foo' ), log(100/202) ); ! # glob the tests directory for files called TestMailParse\d+.msg which consist of messages ! # to be parsed with the resulting classification in TestMailParse.cls ! my @class_tests = sort glob 'TestMailParse*.msg'; for my $class_test (@class_tests) { --- 960,967 ---- test_assert_equal( $b->get_sort_value_( $session, 'personal', 'foo' ), log(100/202) ); ! # glob the tests directory for files called TestMails/TestMailParse\d+.msg which consist of messages ! # to be parsed with the resulting classification in TestMails/TestMailParse.cls ! my @class_tests = sort glob 'TestMails/TestMailParse*.msg'; for my $class_test (@class_tests) { *************** *** 979,983 **** } ! # glob the tests directory for files called TestMailParse\d+.msg which consist of messages # to be sent through classify_and_modify --- 979,983 ---- } ! # glob the tests directory for files called TestMails/TestMailParse\d+.msg which consist of messages # to be sent through classify_and_modify *************** *** 990,994 **** $b->set_bucket_parameter( $session, 'spam', 'xpl', 1 ); ! my @modify_tests = sort glob 'TestMailParse*.msg'; for my $modify_file (@modify_tests) { --- 990,994 ---- $b->set_bucket_parameter( $session, 'spam', 'xpl', 1 ); ! my @modify_tests = sort glob 'TestMails/TestMailParse*.msg'; for my $modify_file (@modify_tests) { |