@INC = '../lib';
}
-@tests = (split(/\nEND\n/s, <<DONE));
+@tests = (split(/\nEND\n/s, <<'DONE'));
TEST1
This
is
Lines
END
+TEST13 break=\d
+I saw 3 ships come sailing in
+END
+ I saw 3 ships come sailing in
+END
+TEST14 break=\d
+the.quick.brown.fox.jumps.over.the.9.lazy.dogs.for.no.good.reason.whatsoever.apparently
+END
+ the.quick.brown.fox.jumps.over.the.
+ .lazy.dogs.for.no.good.reason.whatsoever.apparently
+END
DONE
my $in = shift(@st);
my $out = shift(@st);
- $in =~ s/^TEST(\d+)?\n//;
+ $in =~ s/^TEST(\d+)( break=(.*))?\n//
+ or die "bad TEST header line: $in\n";
+ local $Text::Wrap::break = $3 if defined $3;
my $back = wrap(' ', ' ', $in);
my $in = shift(@st);
my $out = shift(@st);
- $in =~ s/^TEST(\d+)?\n//;
+ $in =~ s/^TEST(\d+)( break=(.*))?\n//
+ or die "bad TEST header line: $in\n";
+ local $Text::Wrap::break = $3 if defined $3;
+
my @in = split("\n", $in, -1);
@in = ((map { "$_\n" } @in[0..$#in-1]), $in[-1]);
pos($t) = 0;
while ($t !~ /\G\s*\Z/gc) {
- if ($t =~ /\G([^\n]{0,$ll})($break|\z)/xmgc) {
+ if ($t =~ /\G([^\n]{0,$ll})($break|\n*\z)/xmgc) {
$r .= $unexpand
? unexpand($nl . $lead . $1)
: $nl . $lead . $1;
Text::Wrap::fill() is a simple multi-paragraph formatter. It formats
each paragraph separately and then joins them together when it's done. It
-will destory any whitespace in the original text. It breaks text into
+will destroy any whitespace in the original text. It breaks text into
paragraphs by looking for whitespace after a newline. In other respects
it acts like wrap().
C<Text::Wrap::wrap()> starts its work by expanding all the tabs in its
input into spaces. The last thing it does it to turn spaces back
into tabs. If you do not want tabs in your results, set
-C<$Text::Wrap::unexapand> to a false value. Likewise if you do not
+C<$Text::Wrap::unexpand> to a false value. Likewise if you do not
want to use 8-character tabstops, set C<$Text::Wrap::tabstop> to
the number of characters you do want for your tabstops.
If you want to separate your lines with something other than C<\n>
-then set C<$Text::Wrap::seporator> to your preference.
+then set C<$Text::Wrap::separator> to your preference.
When words that are longer than C<$columns> are encountered, they
are broken up. C<wrap()> adds a C<"\n"> at column C<$columns>.