Initial import from FreeBSD RELENG_4:
[games.git] / contrib / perl5 / t / lib / textfill.t
1 #!./perl -w
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6 }
7
8 @tests = (split(/\nEND\n/s, <<DONE));
9 TEST1
10 Cyberdog Information
11
12 Cyberdog & Netscape in the news
13 Important Press Release regarding Cyberdog and Netscape. Check it out! 
14
15 Cyberdog Plug-in Support!
16 Cyberdog support for Netscape Plug-ins is now available to download! Go
17 to the Cyberdog Beta Download page and download it now! 
18
19 Cyberdog Book
20 Check out Jesse Feiler's way-cool book about Cyberdog. You can find
21 details out about the book as well as ordering information at Philmont
22 Software Mill site. 
23
24 Java!
25 Looking to view Java applets in Cyberdog 1.1 Beta 3? Download and install
26 the Mac OS Runtime for Java and try it out! 
27
28 Cyberdog 1.1 Beta 3
29 We hope that Cyberdog and OpenDoc 1.1 will be available within the next
30 two weeks. In the meantime, we have released another version of
31 Cyberdog, Cyberdog 1.1 Beta 3. This version fixes several bugs that were
32 reported to us during out public beta period. You can check out our release
33 notes to see what we fixed! 
34 END
35     Cyberdog Information
36     Cyberdog & Netscape in the news Important Press Release regarding
37  Cyberdog and Netscape. Check it out! 
38     Cyberdog Plug-in Support! Cyberdog support for Netscape Plug-ins is now
39  available to download! Go to the Cyberdog Beta Download page and download
40  it now! 
41     Cyberdog Book Check out Jesse Feiler's way-cool book about Cyberdog.
42  You can find details out about the book as well as ordering information at
43  Philmont Software Mill site. 
44     Java! Looking to view Java applets in Cyberdog 1.1 Beta 3? Download and
45  install the Mac OS Runtime for Java and try it out! 
46     Cyberdog 1.1 Beta 3 We hope that Cyberdog and OpenDoc 1.1 will be
47  available within the next two weeks. In the meantime, we have released
48  another version of Cyberdog, Cyberdog 1.1 Beta 3. This version fixes
49  several bugs that were reported to us during out public beta period. You
50  can check out our release notes to see what we fixed! 
51 END
52 DONE
53
54
55 $| = 1;
56
57 print "1..", @tests/2, "\n";
58
59 use Text::Wrap;
60
61 $rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
62
63 $tn = 1;
64 while (@tests) {
65         my $in = shift(@tests);
66         my $out = shift(@tests);
67
68         $in =~ s/^TEST(\d+)?\n//;
69
70         my $back = fill('    ', ' ', $in);
71
72         if ($back eq $out) {
73                 print "ok $tn\n";
74         } elsif ($rerun) {
75                 my $oi = $in;
76                 open(F,">#o") and do { print F $back; close(F) };
77                 open(F,">#e") and do { print F $out;  close(F) };
78                 foreach ($in, $back, $out) {
79                         s/\t/^I\t/gs;
80                         s/\n/\$\n/gs;
81                 }
82                 print "------------ input ------------\n";
83                 print $in;
84                 print "\n------------ output -----------\n";
85                 print $back;
86                 print "\n------------ expected ---------\n";
87                 print $out;
88                 print "\n-------------------------------\n";
89                 $Text::Wrap::debug = 1;
90                 fill('    ', ' ', $oi);
91                 exit(1);
92         } else {
93                 print "not ok $tn\n";
94         }
95         $tn++;
96 }