summaryrefslogtreecommitdiff
path: root/t/comp.cpp
blob: ee7ad73f16e1214723358e6f9baaa9fa27d48d80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!./perl -P

# $Header: comp.cpp,v 1.0 87/12/18 13:12:22 root Exp $

print "1..3\n";

#this is a comment
#define MESS "ok 1\n"
print MESS;

#If you capitalize, it's a comment.
#ifdef MESS
	print "ok 2\n";
#else
	print "not ok 2\n";
#endif

open(try,">Comp.cpp.tmp") || die "Can't open temp perl file.";
print try '$ok = "not ok 3\n";'; print try "\n";
print try "#include <Comp.cpp.inc>\n";
print try "#ifdef OK\n";
print try '$ok = OK;'; print try "\n";
print try "#endif\n";
print try 'print $ok;'; print try "\n";
close try;

open(try,">Comp.cpp.inc") || (die "Can't open temp include file.");
print try '#define OK "ok 3\n"'; print try "\n";
close try;

$pwd=`pwd`;
$pwd =~ s/\n//;
$x = `./perl -P -I$pwd Comp.cpp.tmp`;
print $x;
`/bin/rm -f Comp.cpp.tmp Comp.cpp.inc`;