Be more robust on "extreme" (large absolute value)
[p5sagit/p5-mst-13.2.git] / t / lib / textfill.t
index b40aaff..daeee23 100755 (executable)
@@ -1,4 +1,11 @@
-#!/usr/bin/perl -w -I.
+#!./perl -w
+
+BEGIN {
+    chdir 't' if -d 't';
+    unshift @INC, '../lib';
+}
+
+use Text::Wrap qw(&fill);
 
 @tests = (split(/\nEND\n/s, <<DONE));
 TEST1
@@ -49,9 +56,7 @@ DONE
 
 $| = 1;
 
-print "1..";
-print @tests/2;
-print "\n";
+print "1..", @tests/2, "\n";
 
 use Text::Wrap;
 
@@ -70,9 +75,8 @@ while (@tests) {
                print "ok $tn\n";
        } elsif ($rerun) {
                my $oi = $in;
-               require File::Slurp;
-               File::Slurp::write_file("#o", $back);
-               File::Slurp::write_file("#e", $out);
+               open(F,">#o") and do { print F $back; close(F) };
+               open(F,">#e") and do { print F $out;  close(F) };
                foreach ($in, $back, $out) {
                        s/\t/^I\t/gs;
                        s/\n/\$\n/gs;