Subject: | t/upload.t not passing (newline removed by test when it should not be) |
t/upload.t is not passing on my box (Perl 5.6.1, URI v1.30, LWP 5.800) because the "trim off possible extra newline" instruction does not work as advertised (it *always* trims off the final newline, no matter whether it is a blank line or not). Enclosed patch fixes that.
diff -U3 -r1.1 upload.t
--- t/upload.t 19 Oct 2004 00:18:40 -0000 1.1
+++ t/upload.t 21 Oct 2004 10:31:21 -0000
@@ -4,6 +4,7 @@
use Test::More tests => 6;
use URI::file;
+BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY PATH IFS CDPATH ENV BASH_ENV) }; }
use_ok( 'WWW::Mechanize' );
my $mech = WWW::Mechanize->new( cookie_jar => undef );
@@ -19,7 +20,7 @@
$reqstring =~ s/\r//g;
# trim off possible extra newline
-$reqstring =~ s/\n$//;
+$reqstring =~ s/^\Z\n//m;
my $wanted = <<'EOT';
POST http://localhost/