Commit | Line | Data |
1b24ed4b |
1 | #!./perl -l |
2 | |
3 | # There's a bug in -P where the #! line is ignored. If this test |
4 | # suddenly starts printing blank lines that bug has been fixed. |
16d20bd9 |
5 | |
16d20bd9 |
6 | print "1..3\n"; |
7 | |
16d20bd9 |
8 | #define MESS "ok 1\n" |
9 | print MESS; |
10 | |
16d20bd9 |
11 | #ifdef MESS |
12 | print "ok 2\n"; |
13 | #else |
14 | print "not ok 2\n"; |
15 | #endif |
16 | |
1b24ed4b |
17 | open(TRY,">Comp_cpp.tmp") || die "Can't open temp perl file: $!"; |
16d20bd9 |
18 | |
19 | ($prog = <<'END') =~ s/X//g; |
20 | X$ok = "not ok 3\n"; |
1b24ed4b |
21 | X#include "Comp_cpp.inc" |
16d20bd9 |
22 | X#ifdef OK |
23 | X$ok = OK; |
24 | X#endif |
25 | Xprint $ok; |
26 | END |
27 | print TRY $prog; |
d1e4d418 |
28 | close TRY or die "Could not close Comp_cpp.tmp: $!"; |
16d20bd9 |
29 | |
1b24ed4b |
30 | open(TRY,">Comp_cpp.inc") || (die "Can't open temp include file: $!"); |
16d20bd9 |
31 | print TRY '#define OK "ok 3\n"' . "\n"; |
d1e4d418 |
32 | close TRY or die "Could not close Comp_cpp.tmp: $!"; |
16d20bd9 |
33 | |
1b24ed4b |
34 | print `$^X "-P" Comp_cpp.tmp`; |
35 | unlink "Comp_cpp.tmp", "Comp_cpp.inc"; |