3 @tests = (split(/\nEND\n/s, <<'DONE'));
16 This is a test of a very long line. It should be broken up and put onto multiple lines.
17 This is a test of a very long line. It should be broken up and put onto multiple lines.
19 This is a test of a very long line. It should be broken up and put onto multiple lines.
21 This is a test of a very long line. It should be broken up and put onto
23 This is a test of a very long line. It should be broken up and put onto
26 This is a test of a very long line. It should be broken up and put onto
30 This is a test of a very long line. It should be broken up and put onto multiple lines.
32 This is a test of a very long line. It should be broken up and put onto
36 This is a test of a very long line. It should be broken up and put onto multiple lines.
39 This is a test of a very long line. It should be broken up and put onto
44 This is a test of a very long line. It should be broken up and put onto multiple This is a test of a very long line. It should be broken up and put
46 This is a test of a very long line. It should be broken up and put onto
47 multiple This is a test of a very long line. It should be broken up and
51 11111111 22222222 33333333 44444444 55555555 66666666 77777777 888888888 999999999 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffff gggggggg hhhhhhhh iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmmm nnnnnnnnn ooooooooo ppppppppp qqqqqqqqq rrrrrrrrr sssssssss
53 11111111 22222222 33333333 44444444 55555555 66666666 77777777 888888888
54 999999999 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffff
55 gggggggg hhhhhhhh iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmmm nnnnnnnnn
56 ooooooooo ppppppppp qqqqqqqqq rrrrrrrrr sssssssss
59 c3t1d0s6 c4t1d0s6 c5t1d0s6 c6t1d0s6 c7t1d0s6 c8t1d0s6 c9t1d0s6 c10t1d0s6 c11t1d0s6 c12t1d0s6 c13t1d0s6 c14t1d0s6 c15t1d0s6 c16t1d0s6 c3t1d0s0 c4t1d0s0 c5t1d0s0 c6t1d0s0 c7t1d0s0 c8t1d0s0 c9t1d0s0 c10t1d0s0 c11t1d0s0 c12t1d0s0 c13t1d0s0 c14t1d0s0 c15t1d0s0 c16t1d0s0
61 c3t1d0s6 c4t1d0s6 c5t1d0s6 c6t1d0s6 c7t1d0s6 c8t1d0s6 c9t1d0s6 c10t1d0s6
62 c11t1d0s6 c12t1d0s6 c13t1d0s6 c14t1d0s6 c15t1d0s6 c16t1d0s6 c3t1d0s0
63 c4t1d0s0 c5t1d0s0 c6t1d0s0 c7t1d0s0 c8t1d0s0 c9t1d0s0 c10t1d0s0 c11t1d0s0
64 c12t1d0s0 c13t1d0s0 c14t1d0s0 c15t1d0s0 c16t1d0s0
67 A test of a very very long word.
68 a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
70 A test of a very very long word.
71 a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123
75 A test of a very very long word. a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
77 A test of a very very long word.
78 a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123
83 "never eat paste my darling"
87 "never eat paste my darling"
91 This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn
93 This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_pr
94 ogram_does_not_crash_and_burn
116 I saw 3 ships come sailing in
118 I saw 3 ships come sailing in
121 the.quick.brown.fox.jumps.over.the.9.lazy.dogs.for.no.good.reason.whatsoever.apparently
123 the.quick.brown.fox.jumps.over.the.
124 .lazy.dogs.for.no.good.reason.whatsoever.apparently
131 print "1..", 2 +@tests, "\n";
135 $rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
142 my $out = shift(@st);
144 $in =~ s/^TEST(\d+)( break=(.*))?\n//
145 or die "bad TEST header line: $in\n";
146 local $Text::Wrap::break = $3 if defined $3;
148 my $back = wrap(' ', ' ', $in);
154 foreach ($in, $back, $out) {
158 print "------------ input ------------\n";
160 print "\n------------ output -----------\n";
162 print "\n------------ expected ---------\n";
164 print "\n-------------------------------\n";
165 $Text::Wrap::debug = 1;
169 print "not ok $tn\n";
178 my $out = shift(@st);
180 $in =~ s/^TEST(\d+)( break=(.*))?\n//
181 or die "bad TEST header line: $in\n";
182 local $Text::Wrap::break = $3 if defined $3;
184 my @in = split("\n", $in, -1);
185 @in = ((map { "$_\n" } @in[0..$#in-1]), $in[-1]);
187 my $back = wrap(' ', ' ', @in);
193 foreach ($in, $back, $out) {
197 print "------------ input2 ------------\n";
199 print "\n------------ output2 -----------\n";
201 print "\n------------ expected2 ---------\n";
203 print "\n-------------------------------\n";
204 $Text::Wrap::debug = 1;
208 print "not ok $tn\n";
213 $Text::Wrap::huge = 'overflow';
215 my $tw = 'This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn';
216 my $w = wrap('zzz','yyy',$tw);
217 print (($w eq "zzz$tw") ? "ok $tn\n" : "not ok $tn");
221 local $Text::Wrap::columns = 10;
222 local $Text::Wrap::huge = "wrap";
223 print ((wrap("verylongindent", "", "foo") eq "verylongindent\nfoo") ? "ok $tn\n" : "not ok $tn");