summaryrefslogtreecommitdiff
path: root/cpan/Text-Tabs/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-09-26 17:24:53 +0100
committerNicholas Clark <nick@ccl4.org>2009-09-26 17:51:18 +0100
commitd1f770803c95df0ac5e9e873daa3bb453e913fda (patch)
treed3be770a407c9e6ac7a241d78e1afc1429b10686 /cpan/Text-Tabs/t
parentbfa0af6f4d529b278f8cb84f8526cffd75a4ff4d (diff)
downloadperl-d1f770803c95df0ac5e9e873daa3bb453e913fda.tar.gz
Move Text-Tabs+Wrap from ext/ to cpan/
Diffstat (limited to 'cpan/Text-Tabs/t')
-rw-r--r--cpan/Text-Tabs/t/37000.t29
-rw-r--r--cpan/Text-Tabs/t/39548.t11
-rw-r--r--cpan/Text-Tabs/t/Jacobson.t24
-rw-r--r--cpan/Text-Tabs/t/Jacobson2.t22
-rw-r--r--cpan/Text-Tabs/t/Jochen.t11
-rw-r--r--cpan/Text-Tabs/t/belg4mit.t18
-rw-r--r--cpan/Text-Tabs/t/dandv.t8
-rw-r--r--cpan/Text-Tabs/t/fill.t105
-rw-r--r--cpan/Text-Tabs/t/sep.t173
-rw-r--r--cpan/Text-Tabs/t/sep2.t188
-rw-r--r--cpan/Text-Tabs/t/tabs.t136
-rw-r--r--cpan/Text-Tabs/t/wrap.t225
-rw-r--r--cpan/Text-Tabs/t/wrap_separator2.t13
13 files changed, 963 insertions, 0 deletions
diff --git a/cpan/Text-Tabs/t/37000.t b/cpan/Text-Tabs/t/37000.t
new file mode 100644
index 0000000000..1efbc70f54
--- /dev/null
+++ b/cpan/Text-Tabs/t/37000.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -I.
+
+#Causes Text::Wrap to die...
+use warnings;
+use strict;
+use Text::Wrap;
+
+my $toPrint = "(1) Category\t(2 or greater) New Category\n\n";
+my $good = "(1) Category\t(2 or greater) New Category\n";
+
+my $toprint;
+
+print "1..6\n";
+
+local($Text::Wrap::break) = '\s';
+eval { $toPrint = wrap("","",$toPrint); };
+print $@ ? "not ok 1\n" : "ok 1\n";
+print $toPrint eq $good ? "ok 2\n" : "not ok 2\n";
+
+local($Text::Wrap::break) = '\d';
+eval { $toPrint = wrap("","",$toPrint); };
+print $@ ? "not ok 3\n" : "ok 3\n";
+print $toPrint eq $good ? "ok 4\n" : "not ok 4\n";
+
+local($Text::Wrap::break) = 'a';
+eval { $toPrint = wrap("","",$toPrint); };
+print $@ ? "not ok 5\n" : "ok 5\n";
+print $toPrint eq $good ? "ok 6\n" : "not ok 6\n";
+
diff --git a/cpan/Text-Tabs/t/39548.t b/cpan/Text-Tabs/t/39548.t
new file mode 100644
index 0000000000..6cca0865c1
--- /dev/null
+++ b/cpan/Text-Tabs/t/39548.t
@@ -0,0 +1,11 @@
+#!/usr/bin/perl -w -I.
+
+# https://rt.perl.org/rt3/Ticket/Display.html?id=39548
+
+print "1..1\n";
+require Text::Wrap;
+$VAR1 = " (Karl-Bonhoeffer-Nervenklinik zwischen Hermann-Piper-Str. und U-Bahnhof) ";
+$VAR2 = " ";
+$VAR3 = "(5079,19635 5124,19634 5228,19320 5246,19244)\n";
+eval { Text::Wrap::wrap($VAR1,$VAR2,$VAR3); };
+print $@ ? "not ok 1\n" : "ok 1\n";
diff --git a/cpan/Text-Tabs/t/Jacobson.t b/cpan/Text-Tabs/t/Jacobson.t
new file mode 100644
index 0000000000..d2727e4629
--- /dev/null
+++ b/cpan/Text-Tabs/t/Jacobson.t
@@ -0,0 +1,24 @@
+#!/usr/bin/perl -I.
+
+# From: Dan Jacobson <jidanni at jidanni dot org>
+
+use Text::Wrap qw(wrap $columns $huge $break);
+
+print "1..1\n";
+
+$huge='overflow';
+$Text::Wrap::columns=9;
+$break="(?<=[,.])";
+eval {
+$a=$a=wrap('','',
+"mmmm,n,ooo,ppp.qqqq.rrrrr,sssssssssssss,ttttttttt,uu,vvv wwwwwwwww####\n");
+};
+
+if ($@) {
+ my $e = $@;
+ $e =~ s/^/# /gm;
+ print $e;
+}
+print $@ ? "not ok 1\n" : "ok 1\n";
+
+
diff --git a/cpan/Text-Tabs/t/Jacobson2.t b/cpan/Text-Tabs/t/Jacobson2.t
new file mode 100644
index 0000000000..b7b06faf82
--- /dev/null
+++ b/cpan/Text-Tabs/t/Jacobson2.t
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -I.
+
+use Text::Wrap qw(wrap $columns $huge $break);
+
+print "1..1\n";
+
+$huge='overflow';
+$Text::Wrap::columns=9;
+$break="(?<=[,.])";
+eval {
+$a=$a=wrap('','',
+"mmmm,n,ooo,ppp.qqqq.rrrrr.adsljasdf\nlasjdflajsdflajsdfljasdfl\nlasjdflasjdflasf,sssssssssssss,ttttttttt,uu,vvv wwwwwwwww####\n");
+};
+
+if ($@) {
+ my $e = $@;
+ $e =~ s/^/# /gm;
+ print $e;
+}
+print $@ ? "not ok 1\n" : "ok 1\n";
+
+
diff --git a/cpan/Text-Tabs/t/Jochen.t b/cpan/Text-Tabs/t/Jochen.t
new file mode 100644
index 0000000000..d4a3a8b76a
--- /dev/null
+++ b/cpan/Text-Tabs/t/Jochen.t
@@ -0,0 +1,11 @@
+#!/usr/bin/perl -I.
+
+use Text::Wrap;
+
+print "1..1\n";
+
+$Text::Wrap::columns = 1;
+eval { wrap('', '', ''); };
+
+print $@ ? "not ok 1\n" : "ok 1\n";
+
diff --git a/cpan/Text-Tabs/t/belg4mit.t b/cpan/Text-Tabs/t/belg4mit.t
new file mode 100644
index 0000000000..2d10342c5f
--- /dev/null
+++ b/cpan/Text-Tabs/t/belg4mit.t
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -I.
+
+use Text::Wrap;
+
+print "1..1\n";
+
+$Text::Wrap::columns = 1;
+eval { wrap('', '', 'H4sICNoBwDoAA3NpZwA9jbsNwDAIRHumuC4NklvXTOD0KSJEnwU8fHz4Q8M9i3sGzkS7BBrm
+OkCTwsycb4S3DloZuMIYeXpLFqw5LaMhXC2ymhreVXNWMw9YGuAYdfmAbwomoPSyFJuFn2x8
+Opr8bBBidccAAAA'); };
+
+if ($@) {
+ my $e = $@;
+ $e =~ s/^/# /gm;
+ print $e;
+}
+print $@ ? "not ok 1\n" : "ok 1\n";
+
diff --git a/cpan/Text-Tabs/t/dandv.t b/cpan/Text-Tabs/t/dandv.t
new file mode 100644
index 0000000000..b6ee69ada1
--- /dev/null
+++ b/cpan/Text-Tabs/t/dandv.t
@@ -0,0 +1,8 @@
+
+use Text::Wrap;
+use Test::More tests => 2;
+$Text::Wrap::columns = 4;
+eval { $x = Text::Wrap::wrap('', '123', 'some text'); };
+is($@, '');
+is($x, "some\n123t\n123e\n123x\n123t");
+
diff --git a/cpan/Text-Tabs/t/fill.t b/cpan/Text-Tabs/t/fill.t
new file mode 100644
index 0000000000..dab043297e
--- /dev/null
+++ b/cpan/Text-Tabs/t/fill.t
@@ -0,0 +1,105 @@
+#!/usr/bin/perl -w -I.
+
+@tests = (split(/\nEND\n/s, <<DONE));
+TEST1
+Cyberdog Information
+
+Cyberdog & Netscape in the news
+Important Press Release regarding Cyberdog and Netscape. Check it out!
+
+Cyberdog Plug-in Support!
+Cyberdog support for Netscape Plug-ins is now available to download! Go
+to the Cyberdog Beta Download page and download it now!
+
+Cyberdog Book
+Check out Jesse Feiler's way-cool book about Cyberdog. You can find
+details out about the book as well as ordering information at Philmont
+Software Mill site.
+
+Java!
+Looking to view Java applets in Cyberdog 1.1 Beta 3? Download and install
+the Mac OS Runtime for Java and try it out!
+
+Cyberdog 1.1 Beta 3
+We hope that Cyberdog and OpenDoc 1.1 will be available within the next
+two weeks. In the meantime, we have released another version of
+Cyberdog, Cyberdog 1.1 Beta 3. This version fixes several bugs that were
+reported to us during out public beta period. You can check out our release
+notes to see what we fixed!
+END
+ Cyberdog Information
+ Cyberdog & Netscape in the news Important Press Release regarding
+ Cyberdog and Netscape. Check it out!
+ Cyberdog Plug-in Support! Cyberdog support for Netscape Plug-ins is now
+ available to download! Go to the Cyberdog Beta Download page and download
+ it now!
+ Cyberdog Book Check out Jesse Feiler's way-cool book about Cyberdog.
+ You can find details out about the book as well as ordering information at
+ Philmont Software Mill site.
+ Java! Looking to view Java applets in Cyberdog 1.1 Beta 3? Download and
+ install the Mac OS Runtime for Java and try it out!
+ Cyberdog 1.1 Beta 3 We hope that Cyberdog and OpenDoc 1.1 will be
+ available within the next two weeks. In the meantime, we have released
+ another version of Cyberdog, Cyberdog 1.1 Beta 3. This version fixes
+ several bugs that were reported to us during out public beta period. You
+ can check out our release notes to see what we fixed!
+END
+DONE
+
+
+$| = 1;
+
+print "1..";
+print @tests/2;
+print "\n";
+
+use Text::Wrap;
+
+$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
+
+$tn = 1;
+while (@tests) {
+ my $in = shift(@tests);
+ my $out = shift(@tests);
+
+ $in =~ s/^TEST(\d+)?\n//;
+
+ my $back = fill(' ', ' ', $in);
+
+ if ($back eq $out) {
+ print "ok $tn\n";
+ } elsif ($rerun) {
+ my $oi = $in;
+ write_file("#o", $back);
+ write_file("#e", $out);
+ foreach ($in, $back, $out) {
+ s/\t/^I\t/gs;
+ s/\n/\$\n/gs;
+ }
+ print "------------ input ------------\n";
+ print $in;
+ print "\n------------ output -----------\n";
+ print $back;
+ print "\n------------ expected ---------\n";
+ print $out;
+ print "\n-------------------------------\n";
+ $Text::Wrap::debug = 1;
+ fill(' ', ' ', $oi);
+ exit(1);
+ } else {
+ print "not ok $tn\n";
+ }
+ $tn++;
+}
+
+sub write_file
+{
+ my ($f, @data) = @_;
+
+ local(*F);
+
+ open(F, ">$f") || die "open >$f: $!";
+ (print F @data) || die "write $f: $!";
+ close(F) || die "close $f: $!";
+ return 1;
+}
diff --git a/cpan/Text-Tabs/t/sep.t b/cpan/Text-Tabs/t/sep.t
new file mode 100644
index 0000000000..094f720bc1
--- /dev/null
+++ b/cpan/Text-Tabs/t/sep.t
@@ -0,0 +1,173 @@
+#!/usr/bin/perl -I.
+
+@tests = (split(/\nEND\n/s, <<DONE));
+TEST1
+This
+is
+a
+test
+END
+ This = is= a= test
+END
+TEST2
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+END
+ This is a test of a very long line. It should be broken up and put onto= multiple lines.= This is a test of a very long line. It should be broken up and put onto= multiple lines.= = This is a test of a very long line. It should be broken up and put onto= multiple lines.
+END
+TEST3
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+END
+ This is a test of a very long line. It should be broken up and put onto= multiple lines.
+END
+TEST4
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+
+END
+ This is a test of a very long line. It should be broken up and put onto= multiple lines.
+
+END
+TEST5
+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
+END
+ 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
+END
+TEST6
+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
+END
+ 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
+END
+TEST7
+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
+END
+ 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
+END
+TEST8
+A test of a very very long word.
+a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
+END
+ A test of a very very long word.= a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123= 4567
+END
+TEST9
+A test of a very very long word. a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
+END
+ A test of a very very long word. = a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123= 4567
+END
+TEST10
+my mother once said
+"never eat paste my darling"
+would that I heeded
+END
+ my mother once said= "never eat paste my darling"= would that I heeded
+END
+TEST11
+This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn
+END
+ This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_pr= ogram_does_not_crash_and_burn
+END
+TEST12
+This
+
+Has
+
+Blank
+
+Lines
+
+END
+ This= = Has= = Blank= = Lines
+
+END
+DONE
+
+
+$| = 1;
+
+print "1..", 1 +@tests, "\n";
+
+use Text::Wrap;
+$Text::Wrap::separator = '=';
+
+$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
+
+$tn = 1;
+
+@st = @tests;
+while (@st) {
+ my $in = shift(@st);
+ my $out = shift(@st);
+
+ $in =~ s/^TEST(\d+)?\n//;
+
+ my $back = wrap(' ', ' ', $in);
+
+ if ($back eq $out) {
+ print "ok $tn\n";
+ } elsif ($rerun) {
+ my $oi = $in;
+ foreach ($in, $back, $out) {
+ s/\t/^I\t/gs;
+ s/\n/\$\n/gs;
+ }
+ print "------------ input ------------\n";
+ print $in;
+ print "\n------------ output -----------\n";
+ print $back;
+ print "\n------------ expected ---------\n";
+ print $out;
+ print "\n-------------------------------\n";
+ $Text::Wrap::debug = 1;
+ wrap(' ', ' ', $oi);
+ exit(1);
+ } else {
+ print "not ok $tn\n";
+ }
+ $tn++;
+
+}
+
+@st = @tests;
+while(@st) {
+ my $in = shift(@st);
+ my $out = shift(@st);
+
+ $in =~ s/^TEST(\d+)?\n//;
+
+ my @in = split("\n", $in, -1);
+ @in = ((map { "$_\n" } @in[0..$#in-1]), $in[-1]);
+
+ my $back = wrap(' ', ' ', @in);
+
+ if ($back eq $out) {
+ print "ok $tn\n";
+ } elsif ($rerun) {
+ my $oi = $in;
+ foreach ($in, $back, $out) {
+ s/\t/^I\t/gs;
+ s/\n/\$\n/gs;
+ }
+ print "------------ input2 ------------\n";
+ print $in;
+ print "\n------------ output2 -----------\n";
+ print $back;
+ print "\n------------ expected2 ---------\n";
+ print $out;
+ print "\n-------------------------------\n";
+ $Text::Wrap::debug = 1;
+ wrap(' ', ' ', $oi);
+ exit(1);
+ } else {
+ print "not ok $tn\n";
+ }
+ $tn++;
+}
+
+$Text::Wrap::huge = 'overflow';
+
+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';
+my $w = wrap('zzz','yyy',$tw);
+print (($w eq "zzz$tw") ? "ok $tn\n" : "not ok $tn");
+$tn++;
+
diff --git a/cpan/Text-Tabs/t/sep2.t b/cpan/Text-Tabs/t/sep2.t
new file mode 100644
index 0000000000..4eb8ab563c
--- /dev/null
+++ b/cpan/Text-Tabs/t/sep2.t
@@ -0,0 +1,188 @@
+#!/usr/bin/perl -I.
+
+@tests = (split(/\nEND\n/s, <<DONE));
+TEST1
+This
+is
+a
+test
+END
+ This
+ is
+ a
+ test
+END
+TEST2
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+END
+ This is a test of a very long line. It should be broken up and put onto= multiple lines.
+ This is a test of a very long line. It should be broken up and put onto= multiple lines.
+
+ This is a test of a very long line. It should be broken up and put onto= multiple lines.
+END
+TEST3
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+END
+ This is a test of a very long line. It should be broken up and put onto= multiple lines.
+END
+TEST4
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+
+END
+ This is a test of a very long line. It should be broken up and put onto= multiple lines.
+
+END
+TEST5
+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
+END
+ 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
+END
+TEST6
+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
+END
+ 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
+END
+TEST7
+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
+END
+ 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
+END
+TEST8
+A test of a very very long word.
+a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
+END
+ A test of a very very long word.
+ a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123= 4567
+END
+TEST9
+A test of a very very long word. a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
+END
+ A test of a very very long word. = a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123= 4567
+END
+TEST10
+my mother once said
+"never eat paste my darling"
+would that I heeded
+END
+ my mother once said
+ "never eat paste my darling"
+ would that I heeded
+END
+TEST11
+This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn
+END
+ This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_pr= ogram_does_not_crash_and_burn
+END
+TEST12
+This
+
+Has
+
+Blank
+
+Lines
+
+END
+ This
+
+ Has
+
+ Blank
+
+ Lines
+
+END
+DONE
+
+
+$| = 1;
+
+print "1..", 1 +@tests, "\n";
+
+use Text::Wrap;
+$Text::Wrap::separator2 = '=';
+
+$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
+
+$tn = 1;
+
+@st = @tests;
+while (@st) {
+ my $in = shift(@st);
+ my $out = shift(@st);
+
+ $in =~ s/^TEST(\d+)?\n//;
+
+ my $back = wrap(' ', ' ', $in);
+
+ if ($back eq $out) {
+ print "ok $tn\n";
+ } elsif ($rerun) {
+ my $oi = $in;
+ foreach ($in, $back, $out) {
+ s/\t/^I\t/gs;
+ s/\n/\$\n/gs;
+ }
+ print "------------ input ------------\n";
+ print $in;
+ print "\n------------ output -----------\n";
+ print $back;
+ print "\n------------ expected ---------\n";
+ print $out;
+ print "\n-------------------------------\n";
+ $Text::Wrap::debug = 1;
+ wrap(' ', ' ', $oi);
+ exit(1);
+ } else {
+ print "not ok $tn\n";
+ }
+ $tn++;
+
+}
+
+@st = @tests;
+while(@st) {
+ my $in = shift(@st);
+ my $out = shift(@st);
+
+ $in =~ s/^TEST(\d+)?\n//;
+
+ my @in = split("\n", $in, -1);
+ @in = ((map { "$_\n" } @in[0..$#in-1]), $in[-1]);
+
+ my $back = wrap(' ', ' ', @in);
+
+ if ($back eq $out) {
+ print "ok $tn\n";
+ } elsif ($rerun) {
+ my $oi = $in;
+ foreach ($in, $back, $out) {
+ s/\t/^I\t/gs;
+ s/\n/\$\n/gs;
+ }
+ print "------------ input2 ------------\n";
+ print $in;
+ print "\n------------ output2 -----------\n";
+ print $back;
+ print "\n------------ expected2 ---------\n";
+ print $out;
+ print "\n-------------------------------\n";
+ $Text::Wrap::debug = 1;
+ wrap(' ', ' ', $oi);
+ exit(1);
+ } else {
+ print "not ok $tn\n";
+ }
+ $tn++;
+}
+
+$Text::Wrap::huge = 'overflow';
+
+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';
+my $w = wrap('zzz','yyy',$tw);
+print (($w eq "zzz$tw") ? "ok $tn\n" : "not ok $tn");
+$tn++;
+
diff --git a/cpan/Text-Tabs/t/tabs.t b/cpan/Text-Tabs/t/tabs.t
new file mode 100644
index 0000000000..1bba9a63e2
--- /dev/null
+++ b/cpan/Text-Tabs/t/tabs.t
@@ -0,0 +1,136 @@
+#!/usr/old/bin/perl5.004_01 -w
+
+@tests = (split(/\nEND\n/s, <<DONE));
+TEST 1 u
+ x
+END
+ x
+END
+TEST 2 e
+ x
+END
+ x
+END
+TEST 3 e
+ x
+ y
+ z
+END
+ x
+ y
+ z
+END
+TEST 4 u
+ x
+ y
+ z
+END
+ x
+ y
+ z
+END
+TEST 5 u
+This Is a test of a line with many embedded tabs
+END
+This Is a test of a line with many embedded tabs
+END
+TEST 6 e
+This Is a test of a line with many embedded tabs
+END
+This Is a test of a line with many embedded tabs
+END
+TEST 7 u
+ x
+END
+ x
+END
+TEST 8 e
+
+
+
+
+
+END
+
+
+
+
+
+END
+TEST 9 u
+
+END
+
+END
+TEST 10 u
+
+
+
+
+
+END
+
+
+
+
+
+END
+TEST 11 u
+foobar IN A 140.174.82.12
+
+END
+foobar IN A 140.174.82.12
+
+END
+DONE
+
+$| = 1;
+
+print "1..";
+print @tests/2;
+print "\n";
+
+use Text::Tabs;
+
+$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
+
+$tn = 1;
+while (@tests) {
+ my $in = shift(@tests);
+ my $out = shift(@tests);
+
+ $in =~ s/^TEST\s*(\d+)?\s*(\S+)?\n//;
+
+ if ($2 eq 'e') {
+ $f = \&expand;
+ $fn = 'expand';
+ } else {
+ $f = \&unexpand;
+ $fn = 'unexpand';
+ }
+
+ my $back = &$f($in);
+
+ if ($back eq $out) {
+ print "ok $tn\n";
+ } elsif ($rerun) {
+ my $oi = $in;
+ foreach ($in, $back, $out) {
+ s/\t/^I\t/gs;
+ s/\n/\$\n/gs;
+ }
+ print "------------ input ------------\n";
+ print $in;
+ print "\$\n------------ $fn -----------\n";
+ print $back;
+ print "\$\n------------ expected ---------\n";
+ print $out;
+ print "\$\n-------------------------------\n";
+ $Text::Tabs::debug = 1;
+ my $back = &$f($in);
+ exit(1);
+ } else {
+ print "not ok $tn\n";
+ }
+ $tn++;
+}
diff --git a/cpan/Text-Tabs/t/wrap.t b/cpan/Text-Tabs/t/wrap.t
new file mode 100644
index 0000000000..b9d51f24b6
--- /dev/null
+++ b/cpan/Text-Tabs/t/wrap.t
@@ -0,0 +1,225 @@
+#!/usr/bin/perl
+
+@tests = (split(/\nEND\n/s, <<'DONE'));
+TEST1
+This
+is
+a
+test
+END
+ This
+ is
+ a
+ test
+END
+TEST2
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+END
+ This is a test of a very long line. It should be broken up and put onto
+ multiple lines.
+ This is a test of a very long line. It should be broken up and put onto
+ multiple lines.
+
+ This is a test of a very long line. It should be broken up and put onto
+ multiple lines.
+END
+TEST3
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+END
+ This is a test of a very long line. It should be broken up and put onto
+ multiple lines.
+END
+TEST4
+This is a test of a very long line. It should be broken up and put onto multiple lines.
+
+END
+ This is a test of a very long line. It should be broken up and put onto
+ multiple lines.
+
+END
+TEST5
+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
+END
+ 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
+END
+TEST6
+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
+END
+ 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
+END
+TEST7
+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
+END
+ 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
+END
+TEST8
+A test of a very very long word.
+a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
+END
+ A test of a very very long word.
+ a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123
+ 4567
+END
+TEST9
+A test of a very very long word. a123456789b123456789c123456789d123456789e123456789f123456789g123456789g1234567
+END
+ A test of a very very long word.
+ a123456789b123456789c123456789d123456789e123456789f123456789g123456789g123
+ 4567
+END
+TEST10
+my mother once said
+"never eat paste my darling"
+would that I heeded
+END
+ my mother once said
+ "never eat paste my darling"
+ would that I heeded
+END
+TEST11
+This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_program_does_not_crash_and_burn
+END
+ This_is_a_word_that_is_too_long_to_wrap_we_want_to_make_sure_that_the_pr
+ ogram_does_not_crash_and_burn
+END
+TEST12
+This
+
+Has
+
+Blank
+
+Lines
+
+END
+ This
+
+ Has
+
+ Blank
+
+ 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
+
+
+$| = 1;
+
+print "1..", 2 +@tests, "\n";
+
+use Text::Wrap;
+
+$rerun = $ENV{'PERL_DL_NONLAZY'} ? 0 : 1;
+
+$tn = 1;
+
+@st = @tests;
+while (@st) {
+ my $in = shift(@st);
+ my $out = shift(@st);
+
+ $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);
+
+ if ($back eq $out) {
+ print "ok $tn\n";
+ } elsif ($rerun) {
+ my $oi = $in;
+ foreach ($in, $back, $out) {
+ s/\t/^I\t/gs;
+ s/\n/\$\n/gs;
+ }
+ print "------------ input ------------\n";
+ print $in;
+ print "\n------------ output -----------\n";
+ print $back;
+ print "\n------------ expected ---------\n";
+ print $out;
+ print "\n-------------------------------\n";
+ $Text::Wrap::debug = 1;
+ wrap(' ', ' ', $oi);
+ exit(1);
+ } else {
+ print "not ok $tn\n";
+ }
+ $tn++;
+
+}
+
+@st = @tests;
+while(@st) {
+ my $in = shift(@st);
+ my $out = shift(@st);
+
+ $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]);
+
+ my $back = wrap(' ', ' ', @in);
+
+ if ($back eq $out) {
+ print "ok $tn\n";
+ } elsif ($rerun) {
+ my $oi = $in;
+ foreach ($in, $back, $out) {
+ s/\t/^I\t/gs;
+ s/\n/\$\n/gs;
+ }
+ print "------------ input2 ------------\n";
+ print $in;
+ print "\n------------ output2 -----------\n";
+ print $back;
+ print "\n------------ expected2 ---------\n";
+ print $out;
+ print "\n-------------------------------\n";
+ $Text::Wrap::debug = 1;
+ wrap(' ', ' ', $oi);
+ exit(1);
+ } else {
+ print "not ok $tn\n";
+ }
+ $tn++;
+}
+
+$Text::Wrap::huge = 'overflow';
+
+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';
+my $w = wrap('zzz','yyy',$tw);
+print (($w eq "zzz$tw") ? "ok $tn\n" : "not ok $tn");
+$tn++;
+
+{
+ local $Text::Wrap::columns = 10;
+ local $Text::Wrap::huge = "wrap";
+ print ((wrap("verylongindent", "", "foo") eq "verylongindent\nfoo") ? "ok $tn\n" : "not ok $tn");
+ $tn++;
+}
diff --git a/cpan/Text-Tabs/t/wrap_separator2.t b/cpan/Text-Tabs/t/wrap_separator2.t
new file mode 100644
index 0000000000..b31864fff5
--- /dev/null
+++ b/cpan/Text-Tabs/t/wrap_separator2.t
@@ -0,0 +1,13 @@
+#!/usr/local/bin/perl -w
+#Author: Dan Dascalescu
+use strict;
+use Test::More tests => 1;
+
+use Text::Wrap;
+
+local $Text::Wrap::columns = 15;
+local $Text::Wrap::separator2 = '[N]';
+
+is(wrap('','','some long text here that should be wrapped on at least three lines'),
+"some long text[N]here that[N]should be[N]wrapped on at[N]least three[N]lines",
+'If you just to preserve existing newlines but add new breaks with something else, set $Text::Wrap::separator2 instead.');