xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/comp/cpp.aux (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl -l
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gate# There's a bug in -P where the #! line is ignored.  If this test
4*0Sstevel@tonic-gate# suddenly starts printing blank lines that bug has been fixed.
5*0Sstevel@tonic-gate
6*0Sstevel@tonic-gateprint "1..3\n";
7*0Sstevel@tonic-gate
8*0Sstevel@tonic-gate#define MESS "ok 1\n"
9*0Sstevel@tonic-gateprint MESS;
10*0Sstevel@tonic-gate
11*0Sstevel@tonic-gate#ifdef MESS
12*0Sstevel@tonic-gate	print "ok 2\n";
13*0Sstevel@tonic-gate#else
14*0Sstevel@tonic-gate	print "not ok 2\n";
15*0Sstevel@tonic-gate#endif
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gateopen(TRY,">Comp_cpp.tmp") || die "Can't open temp perl file: $!";
18*0Sstevel@tonic-gate
19*0Sstevel@tonic-gate($prog = <<'END') =~ s/X//g;
20*0Sstevel@tonic-gateX$ok = "not ok 3\n";
21*0Sstevel@tonic-gateX#include "Comp_cpp.inc"
22*0Sstevel@tonic-gateX#ifdef OK
23*0Sstevel@tonic-gateX$ok = OK;
24*0Sstevel@tonic-gateX#endif
25*0Sstevel@tonic-gateXprint $ok;
26*0Sstevel@tonic-gateEND
27*0Sstevel@tonic-gateprint TRY $prog;
28*0Sstevel@tonic-gateclose TRY or die "Could not close Comp_cpp.tmp: $!";
29*0Sstevel@tonic-gate
30*0Sstevel@tonic-gateopen(TRY,">Comp_cpp.inc") || (die "Can't open temp include file: $!");
31*0Sstevel@tonic-gateprint TRY '#define OK "ok 3\n"' . "\n";
32*0Sstevel@tonic-gateclose TRY or die "Could not close Comp_cpp.tmp: $!";
33*0Sstevel@tonic-gate
34*0Sstevel@tonic-gateprint `$^X "-P" Comp_cpp.tmp`;
35*0Sstevel@tonic-gateunlink "Comp_cpp.tmp", "Comp_cpp.inc";
36