10 my $CAT = ($^O eq 'MSWin32') ? 'type'
11 : ($^O eq 'MacOS') ? 'catenate' : 'cat';
25 now @<<the@>>>> for all@|||||men to come @<<<<
27 'i' . 's', "time\n", $good, 'to'
31 open(OUT, '>Op_write.tmp') || die "Can't create Op_write.tmp";
35 $multiline = "forescore\nand\nseven years\n";
36 $foo = 'when in the course of human events it becomes necessary';
49 now is the time for all good men to come to\n";
51 if (`$CAT Op_write.tmp` eq $right)
52 { print "ok 1\n"; 1 while unlink 'Op_write.tmp'; }
54 { print "not ok 1\n"; }
57 my $fox = 'foxiness'; # Test a lexical variable.
67 now @<<the@>>>> for all@|||||men to come @<<<<
68 'i' . 's', "time\n", $good, 'to'
71 open OUT2, '>Op_write.tmp' or die "Can't create Op_write.tmp";
74 $multiline = "forescore\nand\nseven years\n";
75 $foo = 'when in the course of human events it becomes necessary';
91 now is the time for all good men to come to\n";
93 if (`$CAT Op_write.tmp` eq $right)
94 { print "ok 2\n"; 1 while unlink 'Op_write.tmp'; }
96 { print "not ok 2\n"; }
108 now @<<the@>>>> for all@|||||men to come @<<<<
109 'i' . 's', "time\n", $good, 'to'
113 open(OUT2, '>Op_write.tmp') || die "Can't create Op_write.tmp";
117 $multiline = "forescore\nand\nseven years\n";
118 $foo = 'when in the course of human events it becomes necessary';
135 now is the time for all good men to come to\n";
137 if (`$CAT Op_write.tmp` eq $right)
138 { print "ok 3\n"; 1 while unlink 'Op_write.tmp'; }
140 { print "not ok 3\n"; }
162 my $format1 = '@' . '>' x $_;
163 formline $format1, 'abc';
164 $was1 .= "$format1 $^A\n";
167 local $format2 = '@' . '>' x $_;
168 formline $format2, 'abc';
169 $was2 .= "$format2 $^A\n";
171 print $was1 eq $mustbe ? "ok 4\n" : "not ok 4\n";
172 print $was2 eq $mustbe ? "ok 5\n" : "not ok 5\n";
183 open(OUT3, '>Op_write.tmp') || die "Can't create Op_write.tmp";
192 if (`$CAT Op_write.tmp` eq $right)
193 { print "ok 6\n"; 1 while unlink 'Op_write.tmp'; }
195 { print "not ok 6\n"; }
197 # test lexicals and globals
205 open(LEX, ">&STDOUT") or die;
211 # LEX_INTERPNORMAL test
217 open OUT4, ">Op_write.tmp" or die "Can't create Op_write.tmp";
220 if (`$CAT Op_write.tmp` eq "1\n") {
222 1 while unlink "Op_write.tmp";
235 open(OUT10, '>Op_write.tmp') || die "Can't create Op_write.tmp";
241 $right = " 12.95 00012.95\n";
242 if (`$CAT Op_write.tmp` eq $right)
243 { print "ok 10\n"; 1 while unlink 'Op_write.tmp'; }
245 { print "not ok 10\n"; }
258 open(OUT11, '>Op_write.tmp') || die "Can't create Op_write.tmp";
268 if (`$CAT Op_write.tmp` eq $right)
269 { print "ok 11\n"; 1 while unlink 'Op_write.tmp'; }
271 { print "not ok 11\n"; }
273 # 12..44: scary format testing from Merijn H. Brand
275 use strict; # Amazed that this hackery can be made strict ...
277 # Just a complete test for format, including top-, left- and bottom marging
278 # and format detection through glob entries
280 $= = 7; # Page length
281 my $ps = $^L; $^L = ""; # Catch the page separator
282 my $tm = 1; # Top margin (empty lines before first output)
283 my $bm = 2; # Bottom marging (empty lines between last text and footer)
284 my $lm = 4; # Left margin (indent in spaces)
286 if ($lm > 0 and !open STDOUT, "|-") { # Left margin (in this test ALWAYS set)
291 print + ($_ eq <DATA> ? "" : "not "), "ok ", $i++, "\n";
294 print + (<DATA>?"not ":""), "ok ", $i++, "\n";
299 $= -= $bm + 1; # count one for the trailing "----"
312 $% == 1 and return "";
314 $lastmin < $= and print "\n" x $lastmin;
315 print "\n" x $bm, "----\n", $ps;
320 # Yes, this is sick ;-)
333 @{(shift @E)||["",""]}
343 exists $::{$fmt} or return 0;
344 $^O eq "MSWin32" or return defined *{$::{$fmt}}{FORMAT};
345 open my $null, "> /dev/null" or die;
346 my $fh = select $null;
353 $^ = has_format ("TOP") ? "TOP" : "EmptyTOP";
354 has_format ("ENTRY") or die "No format defined for ENTRY";
355 foreach my $e ( [ map { [ $_, "Test$_" ] } 1 .. 7 ],
356 [ map { [ $_, "${_}tseT" ] } 1 .. 5 ]) {
360 has_format ("EOR") or next;
364 if (has_format ("EOF")) {