misc tweaks
[p5sagit/p5-mst-13.2.git] / t / lib / textwrap.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6 }
7
8 print "1..5\n";
9
10 use Text::Wrap qw(wrap $columns);
11
12 $columns = 30;
13
14 $text = <<'EOT';
15 Text::Wrap is a very simple paragraph formatter.  It formats a
16 single paragraph at a time by breaking lines at word boundries.
17 Indentation is controlled for the first line ($initial_tab) and
18 all subsquent lines ($subsequent_tab) independently.  $Text::Wrap::columns
19 should be set to the full width of your output device.
20 EOT
21
22 $text =~ s/\n/ /g;
23 $_ = wrap "|  ", "|", $text;
24
25 #print "$_\n";
26
27 print "not " unless /^\|  Text::Wrap is/;  # start is ok
28 print "ok 1\n";
29
30 print "not " if /^.{31,}$/m;  # no line longer than 30 chars
31 print "ok 2\n";
32
33 print "not " unless /^\|\w/m;  # other lines start with 
34 print "ok 3\n";
35
36 print "not " unless /\bsubsquent\b/; # look for a random word
37 print "ok 4\n";
38
39 print "not " unless /\bdevice\./;  # look for last word
40 print "ok 5\n";