diff options
author | Michael G. Schwern <schwern@pobox.com> | 2001-01-26 04:28:31 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-01-26 15:03:23 +0000 |
commit | 0110aa014f97741d8a9f48382bd97bfc15d8cd60 (patch) | |
tree | 57693c0b11bd7360b48ae708c410fafa85de8999 /t | |
parent | c52f9dcd042177cd20ef53fca007b7305fd4972f (diff) | |
download | perl-0110aa014f97741d8a9f48382bd97bfc15d8cd60.tar.gz |
(Retracted by #8573)
Subject: [PATCH Text::Wrap 2000.06292219] Spurious leading whitespace
Message-ID: <20010126092831.A15328@blackrider.aocn.com>
p4raw-id: //depot/perl@8552
Diffstat (limited to 't')
-rwxr-xr-x | t/lib/textwrap.t | 65 |
1 files changed, 41 insertions, 24 deletions
diff --git a/t/lib/textwrap.t b/t/lib/textwrap.t index af24036f85..2c4608cb81 100755 --- a/t/lib/textwrap.t +++ b/t/lib/textwrap.t @@ -84,12 +84,21 @@ END a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123 4567 END +TEST10 +my mother once said +"never eat paste my darling" +would that I heeded +END + my mother once said + "never eat paste my darling" + would that I heeded +END DONE $| = 1; -print "1..", @tests/2, "\n"; +print "1..". @tests . "\n"; use Text::Wrap; @@ -102,28 +111,36 @@ while (@tests) { $in =~ s/^TEST(\d+)?\n//; - my $back = wrap(' ', ' ', $in); + # Make sure split() doesn't drop trailing empty sets. + my @in = split("\n", $in, -1); + @in = ((map { "$_\n" } @in[0..$#in-1]), $in[-1]); + + # We run wrap() both with a string and a list to test its + # line joining logic. + foreach my $back (wrap(' ', ' ', @in), + wrap(' ', ' ', $in) ) { - if ($back eq $out) { - print "ok $tn\n"; - } elsif ($rerun) { - my $oi = $in; - foreach ($in, $back, $out) { - s/\t/^I\t/gs; - s/\n/\$\n/gs; - } - print "------------ input ------------\n"; - print $in; - print "\n------------ output -----------\n"; - print $back; - print "\n------------ expected ---------\n"; - print $out; - print "\n-------------------------------\n"; - $Text::Wrap::debug = 1; - wrap(' ', ' ', $oi); - exit(1); - } else { - print "not ok $tn\n"; - } - $tn++; + if ($back eq $out) { + print "ok $tn\n"; + } elsif ($rerun) { + my $oi = $in; + foreach ($in, $back, $out) { + s/\t/^I\t/gs; + s/\n/\$\n/gs; + } + print "------------ input ------------\n"; + print $in; + print "\n------------ output -----------\n"; + print $back; + print "\n------------ expected ---------\n"; + print $out; + print "\n-------------------------------\n"; + $Text::Wrap::debug = 1; + wrap(' ', ' ', $oi); + exit(1); + } else { + print "not ok $tn\n"; + } + $tn++; + } } |