Commit | Line | Data |
9a09eeb5 |
1 | #!./perl -w |
1a3850a5 |
2 | |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
93430cb4 |
5 | unshift @INC, '../lib'; |
1a3850a5 |
6 | } |
644a2880 |
7 | use Text::Wrap qw(&wrap); |
1a3850a5 |
8 | |
9a09eeb5 |
9 | @tests = (split(/\nEND\n/s, <<DONE)); |
10 | TEST1 |
11 | This |
12 | is |
13 | a |
14 | test |
15 | END |
16 | This |
17 | is |
18 | a |
19 | test |
20 | END |
21 | TEST2 |
22 | This is a test of a very long line. It should be broken up and put onto multiple lines. |
23 | This is a test of a very long line. It should be broken up and put onto multiple lines. |
1a3850a5 |
24 | |
9a09eeb5 |
25 | This is a test of a very long line. It should be broken up and put onto multiple lines. |
26 | END |
27 | This is a test of a very long line. It should be broken up and put onto |
28 | multiple lines. |
29 | This is a test of a very long line. It should be broken up and put onto |
30 | multiple lines. |
31 | |
32 | This is a test of a very long line. It should be broken up and put onto |
33 | multiple lines. |
34 | END |
35 | TEST3 |
36 | This is a test of a very long line. It should be broken up and put onto multiple lines. |
37 | END |
38 | This is a test of a very long line. It should be broken up and put onto |
39 | multiple lines. |
40 | END |
41 | TEST4 |
42 | This is a test of a very long line. It should be broken up and put onto multiple lines. |
1a3850a5 |
43 | |
9a09eeb5 |
44 | END |
45 | This is a test of a very long line. It should be broken up and put onto |
46 | multiple lines. |
1a3850a5 |
47 | |
9a09eeb5 |
48 | END |
49 | TEST5 |
50 | 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 |
51 | END |
52 | This is a test of a very long line. It should be broken up and put onto |
53 | multiple This is a test of a very long line. It should be broken up and |
54 | put |
55 | END |
56 | TEST6 |
57 | 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 |
58 | END |
59 | 11111111 22222222 33333333 44444444 55555555 66666666 77777777 888888888 |
60 | 999999999 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffff |
61 | gggggggg hhhhhhhh iiiiiiii jjjjjjjj kkkkkkkk llllllll mmmmmmmmm nnnnnnnnn |
62 | ooooooooo ppppppppp qqqqqqqqq rrrrrrrrr sssssssss |
63 | END |
64 | TEST7 |
65 | 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 |
66 | END |
67 | c3t1d0s6 c4t1d0s6 c5t1d0s6 c6t1d0s6 c7t1d0s6 c8t1d0s6 c9t1d0s6 c10t1d0s6 |
68 | c11t1d0s6 c12t1d0s6 c13t1d0s6 c14t1d0s6 c15t1d0s6 c16t1d0s6 c3t1d0s0 |
69 | c4t1d0s0 c5t1d0s0 c6t1d0s0 c7t1d0s0 c8t1d0s0 c9t1d0s0 c10t1d0s0 c11t1d0s0 |
70 | c12t1d0s0 c13t1d0s0 c14t1d0s0 c15t1d0s0 c16t1d0s0 |
71 | END |
72 | TEST8 |
73 | A test of a very very long word. |
74 | a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567 |
75 | END |
76 | A test of a very very long word. |
77 | a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123 |
78 | 4567 |
79 | END |
80 | TEST9 |
81 | A test of a very very long word. a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567 |
82 | END |
83 | A test of a very very long word. |
84 | a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123 |
85 | 4567 |
86 | END |
87 | DONE |
1a3850a5 |
88 | |
1a3850a5 |
89 | |
9a09eeb5 |
90 | $| = 1; |
1a3850a5 |
91 | |
555834d1 |
92 | print "1..", @tests/2, "\n"; |
1a3850a5 |
93 | |
9a09eeb5 |
94 | use Text::Wrap; |
1a3850a5 |
95 | |
9a09eeb5 |
96 | $rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1; |
1a3850a5 |
97 | |
9a09eeb5 |
98 | $tn = 1; |
99 | while (@tests) { |
100 | my $in = shift(@tests); |
101 | my $out = shift(@tests); |
1a3850a5 |
102 | |
9a09eeb5 |
103 | $in =~ s/^TEST(\d+)?\n//; |
104 | |
105 | my $back = wrap(' ', ' ', $in); |
106 | |
107 | if ($back eq $out) { |
108 | print "ok $tn\n"; |
109 | } elsif ($rerun) { |
110 | my $oi = $in; |
111 | foreach ($in, $back, $out) { |
112 | s/\t/^I\t/gs; |
113 | s/\n/\$\n/gs; |
114 | } |
115 | print "------------ input ------------\n"; |
116 | print $in; |
117 | print "\n------------ output -----------\n"; |
118 | print $back; |
119 | print "\n------------ expected ---------\n"; |
120 | print $out; |
121 | print "\n-------------------------------\n"; |
122 | $Text::Wrap::debug = 1; |
123 | wrap(' ', ' ', $oi); |
124 | exit(1); |
125 | } else { |
126 | print "not ok $tn\n"; |
127 | } |
128 | $tn++; |
129 | } |