10 my $CAT = ($^O eq 'MSWin32') ? 'type' : 'cat';
24 now @<<the@>>>> for all@|||||men to come @<<<<
26 'i' . 's', "time\n", $good, 'to'
30 open(OUT, '>Op_write.tmp') || die "Can't create Op_write.tmp";
34 $multiline = "forescore\nand\nseven years\n";
35 $foo = 'when in the course of human events it becomes necessary';
48 now is the time for all good men to come to\n";
50 if (`$CAT Op_write.tmp` eq $right)
51 { print "ok 1\n"; 1 while unlink 'Op_write.tmp'; }
53 { print "not ok 1\n"; }
56 my $fox = 'foxiness'; # Test a lexical variable.
66 now @<<the@>>>> for all@|||||men to come @<<<<
67 'i' . 's', "time\n", $good, 'to'
70 open OUT2, '>Op_write.tmp' or die "Can't create Op_write.tmp";
73 $multiline = "forescore\nand\nseven years\n";
74 $foo = 'when in the course of human events it becomes necessary';
90 now is the time for all good men to come to\n";
92 if (`$CAT Op_write.tmp` eq $right)
93 { print "ok 2\n"; 1 while unlink 'Op_write.tmp'; }
95 { print "not ok 2\n"; }
107 now @<<the@>>>> for all@|||||men to come @<<<<
108 'i' . 's', "time\n", $good, 'to'
112 open(OUT2, '>Op_write.tmp') || die "Can't create Op_write.tmp";
116 $multiline = "forescore\nand\nseven years\n";
117 $foo = 'when in the course of human events it becomes necessary';
134 now is the time for all good men to come to\n";
136 if (`$CAT Op_write.tmp` eq $right)
137 { print "ok 3\n"; 1 while unlink 'Op_write.tmp'; }
139 { print "not ok 3\n"; }
161 my $format1 = '@' . '>' x $_;
162 formline $format1, 'abc';
163 $was1 .= "$format1 $^A\n";
166 local $format2 = '@' . '>' x $_;
167 formline $format2, 'abc';
168 $was2 .= "$format2 $^A\n";
170 print $was1 eq $mustbe ? "ok 4\n" : "not ok 4\n";
171 print $was2 eq $mustbe ? "ok 5\n" : "not ok 5\n";
182 open(OUT3, '>Op_write.tmp') || die "Can't create Op_write.tmp";
191 if (`$CAT Op_write.tmp` eq $right)
192 { print "ok 6\n"; 1 while unlink 'Op_write.tmp'; }
194 { print "not ok 6\n"; }
196 # test lexicals and globals
204 open(LEX, ">&STDOUT") or die;
210 # LEX_INTERPNORMAL test
216 open OUT4, ">Op_write.tmp" or die "Can't create Op_write.tmp";
219 if (`$CAT Op_write.tmp` eq "1\n") {
221 1 while unlink "Op_write.tmp";
234 open(OUT10, '>Op_write.tmp') || die "Can't create Op_write.tmp";
240 $right = " 12.95 00012.95\n";
241 if (`$CAT Op_write.tmp` eq $right)
242 { print "ok 10\n"; 1 while unlink 'Op_write.tmp'; }
244 { print "not ok 10\n"; }
257 open(OUT11, '>Op_write.tmp') || die "Can't create Op_write.tmp";
267 if (`$CAT Op_write.tmp` eq $right)
268 { print "ok 11\n"; 1 while unlink 'Op_write.tmp'; }
270 { print "not ok 11\n"; }
272 # 12..44: scary format testing from Merijn H. Brand
274 use strict; # Amazed that this hackery can be made strict ...
276 # Just a complete test for format, including top-, left- and bottom marging
277 # and format detection through glob entries
279 $= = 7; # Page length
280 my $ps = $^L; $^L = ""; # Catch the page separator
281 my $tm = 1; # Top margin (empty lines before first output)
282 my $bm = 2; # Bottom marging (empty lines between last text and footer)
283 my $lm = 4; # Left margin (indent in spaces)
285 if ($lm > 0 and !open STDOUT, "|-") { # Left margin (in this test ALWAYS set)
290 print + ($_ eq <DATA> ? "" : "not "), "ok ", $i++, "\n";
293 print + (<DATA>?"not ":""), "ok ", $i++, "\n";
298 $= -= $bm + 1; # count one for the trailing "----"
311 $% == 1 and return "";
313 $lastmin < $= and print "\n" x $lastmin;
314 print "\n" x $bm, "----\n", $ps;
319 # Yes, this is sick ;-)
332 @{(shift @E)||["",""]}
342 exists $::{$fmt} or return 0;
343 $^O eq "MSWin32" or return defined *{$::{$fmt}}{FORMAT};
344 open my $null, "> /dev/null" or die;
345 my $fh = select $null;
352 $^ = has_format ("TOP") ? "TOP" : "EmptyTOP";
353 has_format ("ENTRY") or die "No format defined for ENTRY";
354 foreach my $e ( [ map { [ $_, "Test$_" ] } 1 .. 7 ],
355 [ map { [ $_, "${_}tseT" ] } 1 .. 5 ]) {
359 has_format ("EOR") or next;
363 if (has_format ("EOF")) {