summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorJohn Peacock <jpeacock@rowman.com>2000-05-18 07:55:27 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2000-10-25 21:03:50 +0000
commit784707d55e15908335a8276d5ed4548baa321d1f (patch)
treef6d0c3be03e31678960cc7b9769a90f4a8fe1ef4 /t/op
parentae21d580cc4565c4ab54286c723cd431c96dedeb (diff)
downloadperl-784707d55e15908335a8276d5ed4548baa321d1f.tar.gz
Zero-padded Numerics in Perl Format
Message-ID: <3924126F.A58BE57A@UnivPress.com> p4raw-id: //depot/perl@7444
Diffstat (limited to 't/op')
-rwxr-xr-xt/op/write.t57
1 files changed, 51 insertions, 6 deletions
diff --git a/t/op/write.t b/t/op/write.t
index 5b01eb78b7..fc155a88c7 100755
--- a/t/op/write.t
+++ b/t/op/write.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..9\n";
+print "1..11\n";
my $CAT = ($^O eq 'MSWin32') ? 'type' : 'cat';
@@ -43,7 +43,7 @@ of huma...
now is the time for all good men to come to\n";
if (`$CAT Op_write.tmp` eq $right)
- { print "ok 1\n"; unlink 'Op_write.tmp'; }
+ { print "ok 1\n"; 1 while unlink 'Op_write.tmp'; }
else
{ print "not ok 1\n"; }
@@ -85,7 +85,7 @@ necessary
now is the time for all good men to come to\n";
if (`$CAT Op_write.tmp` eq $right)
- { print "ok 2\n"; unlink 'Op_write.tmp'; }
+ { print "ok 2\n"; 1 while unlink 'Op_write.tmp'; }
else
{ print "not ok 2\n"; }
@@ -129,7 +129,7 @@ necessary
now is the time for all good men to come to\n";
if (`$CAT Op_write.tmp` eq $right)
- { print "ok 3\n"; unlink 'Op_write.tmp'; }
+ { print "ok 3\n"; 1 while unlink 'Op_write.tmp'; }
else
{ print "not ok 3\n"; }
@@ -184,7 +184,7 @@ $right =
"fit\n";
if (`$CAT Op_write.tmp` eq $right)
- { print "ok 6\n"; unlink 'Op_write.tmp'; }
+ { print "ok 6\n"; 1 while unlink 'Op_write.tmp'; }
else
{ print "not ok 6\n"; }
@@ -213,8 +213,53 @@ write (OUT4);
close OUT4;
if (`$CAT Op_write.tmp` eq "1\n") {
print "ok 9\n";
- unlink "Op_write.tmp";
+ 1 while unlink "Op_write.tmp";
}
else {
print "not ok 9\n";
}
+
+eval <<'EOFORMAT';
+format OUT10 =
+@####.## @0###.##
+$test1, $test1
+.
+EOFORMAT
+
+open(OUT10, '>Op_write.tmp') || die "Can't create Op_write.tmp";
+
+$test1 = 12.95;
+write(OUT10);
+close OUT10;
+
+$right = " 12.95 00012.95\n";
+if (`$CAT Op_write.tmp` eq $right)
+ { print "ok 10\n"; 1 while unlink 'Op_write.tmp'; }
+else
+ { print "not ok 10\n"; }
+
+eval <<'EOFORMAT';
+format OUT11 =
+@0###.##
+$test1
+@ 0#
+$test1
+@0 #
+$test1
+.
+EOFORMAT
+
+open(OUT11, '>Op_write.tmp') || die "Can't create Op_write.tmp";
+
+$test1 = 12.95;
+write(OUT11);
+close OUT11;
+
+$right =
+"00012.95
+1 0#
+10 #\n";
+if (`$CAT Op_write.tmp` eq $right)
+ { print "ok 11\n"; 1 while unlink 'Op_write.tmp'; }
+else
+ { print "not ok 11\n"; }