summaryrefslogtreecommitdiff
path: root/t/comp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 't/comp.cpp')
-rw-r--r--t/comp.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/comp.cpp b/t/comp.cpp
new file mode 100644
index 0000000000..ee7ad73f16
--- /dev/null
+++ b/t/comp.cpp
@@ -0,0 +1,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`;