|
From: <jgr...@us...> - 2003-08-20 11:42:48
|
Update of /cvsroot/popfile/engine/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv11831/tests
Modified Files:
TestBayes.tst
Log Message:
Correct echo_to_dot_ tests
Index: TestBayes.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestBayes.tst,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** TestBayes.tst 1 Aug 2003 00:59:56 -0000 1.22
--- TestBayes.tst 20 Aug 2003 10:54:57 -0000 1.23
***************
*** 30,33 ****
--- 30,35 ----
test_assert( `cp stopwords.base stopwords` == 0 );
+ mkdir 'messages';
+
use Classifier::Bayes;
use POPFile::Configuration;
***************
*** 616,625 ****
# to a file (no dot)
! open TEMP, ">temp.tmp";
open MAIL, "<messages/one.msg";
! $b->echo_to_dot_( \*MAIL, undef, \*TEMP );
test_assert( eof( MAIL ) );
close MAIL;
- close TEMP;
open TEMP, "<temp.tmp";
--- 618,626 ----
# to a file (no dot)
! unlink( 'temp.tmp' );
open MAIL, "<messages/one.msg";
! $b->echo_to_dot_( \*MAIL, undef, 'temp.tmp' );
test_assert( eof( MAIL ) );
close MAIL;
open TEMP, "<temp.tmp";
***************
*** 628,632 ****
my $temp = <TEMP>;
my $mail = <MAIL>;
! last if ( $mail =~ /^./ );
test_assert_regexp( $temp, $mail );
}
--- 629,635 ----
my $temp = <TEMP>;
my $mail = <MAIL>;
! if ( $mail =~ /^\./ ) {
! last;
! }
test_assert_regexp( $temp, $mail );
}
***************
*** 638,648 ****
# both
! open TEMP, ">temp.tmp";
open TEMP2, ">temp2.tmp";
open MAIL, "<messages/one.msg";
! $b->echo_to_dot_( \*MAIL, \*TEMP2, \*TEMP );
test_assert( eof( MAIL ) );
close MAIL;
! close TEMP;
open TEMP, "<temp.tmp";
--- 641,651 ----
# both
! unlink( 'temp.tmp' );
open TEMP2, ">temp2.tmp";
open MAIL, "<messages/one.msg";
! $b->echo_to_dot_( \*MAIL, \*TEMP2, 'temp.tmp' );
test_assert( eof( MAIL ) );
close MAIL;
! close TEMP2;
open TEMP, "<temp.tmp";
***************
*** 651,658 ****
while ( !eof( MAIL ) && !eof( TEMP ) && !eof( TEMP2 ) ) {
my $temp = <TEMP>;
! my $temp2 = <TEMP>;
my $mail = <MAIL>;
test_assert_regexp( $temp2, $mail );
! last if ( $mail =~ /^./ );
test_assert_regexp( $temp, $mail );
}
--- 654,661 ----
while ( !eof( MAIL ) && !eof( TEMP ) && !eof( TEMP2 ) ) {
my $temp = <TEMP>;
! my $temp2 = <TEMP2>;
my $mail = <MAIL>;
test_assert_regexp( $temp2, $mail );
! last if ( $mail =~ /^\./ );
test_assert_regexp( $temp, $mail );
}
***************
*** 666,675 ****
# to a file (no dot) with before string
! open TEMP, ">temp.tmp";
open MAIL, "<messages/one.msg";
! $b->echo_to_dot_( \*MAIL, undef, \*TEMP, "before\n" );
test_assert( eof( MAIL ) );
close MAIL;
- close TEMP;
open TEMP, "<temp.tmp";
--- 669,677 ----
# to a file (no dot) with before string
! unlink( 'temp.tmp' );
open MAIL, "<messages/one.msg";
! $b->echo_to_dot_( \*MAIL, undef, 'temp.tmp', "before\n" );
test_assert( eof( MAIL ) );
close MAIL;
open TEMP, "<temp.tmp";
***************
*** 678,682 ****
my $temp = <TEMP>;
my $mail = <MAIL>;
! if ( $mail =~ /^./ ) {
test_assert_regexp( $temp, 'before' );
last;
--- 680,684 ----
my $temp = <TEMP>;
my $mail = <MAIL>;
! if ( $mail =~ /^\./ ) {
test_assert_regexp( $temp, 'before' );
last;
***************
*** 684,688 ****
test_assert_regexp( $temp, $mail );
}
! test_assert( !eof( MAIL ) );
test_assert( eof( TEMP ) );
close MAIL;
--- 686,690 ----
test_assert_regexp( $temp, $mail );
}
! test_assert( eof( MAIL ) );
test_assert( eof( TEMP ) );
close MAIL;
|