Subject: | generating output file for empty string fails |
The reason is a simple mistake in line 72 ("or" should be used instead
of "||").
Find attached a patch for Regression.pm and a patch for regression.t (a
new test case for empty string is added).
Subject: | regression.t.patch |
*** regression.t.orig 2009-09-13 12:03:44.000000000 +0200
--- regression.t 2010-01-21 14:11:48.000000000 +0100
***************
*** 29,34 ****
--- 29,37 ----
die "How am I doing?";
}
+ sub empty_string_function {
+ return '';
+ }
test_out("ok 1 - f1 gen");
***************
*** 37,42 ****
--- 40,47 ----
test_out("not ok 4 - f2 check");
test_out("not ok 5 - f3 gen");
test_out("not ok 6 - f3 check");
+ test_out("ok 7 - f4 gen");
+ test_out("ok 8 - f4 check");
test_diag(" Failed test 'f2 check'");
$ENV{TEST_REGRESSION_GEN} = 1;
***************
*** 51,56 ****
--- 56,65 ----
ok_regression(\&fatal_function, "t/output/f3", "f3 gen");
delete $ENV{TEST_REGRESSION_GEN};
ok_regression(\&fatal_function, "t/output/f3", "f3 check");
+ $ENV{TEST_REGRESSION_GEN} = 1;
+ ok_regression(\&empty_string_function, "t/output/f4", "f4 gen");
+ delete $ENV{TEST_REGRESSION_GEN};
+ ok_regression(\&empty_string_function, "t/output/f4", "f4 check");
test_test(name=>"blah", skip_err=>1);
Subject: | Regression.pm.patch |
*** Regression.pm.orig 2009-09-28 21:52:17.000000000 +0200
--- Regression.pm 2010-01-21 21:40:46.000000000 +0100
***************
*** 69,75 ****
if ($ENV{TEST_REGRESSION_GEN}) {
my $fh = FileHandle->new;
$fh->open(">$file") || return $tb->ok(0, "$test_name: cannot open $file");
! print {$fh} $output || return $tb->ok(0, "actual write failed: $file");
return $tb->ok($fh->close, $test_name);
}
--- 69,75 ----
if ($ENV{TEST_REGRESSION_GEN}) {
my $fh = FileHandle->new;
$fh->open(">$file") || return $tb->ok(0, "$test_name: cannot open $file");
! print {$fh} $output or return $tb->ok(0, "actual write failed: $file");
return $tb->ok($fh->close, $test_name);
}