aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/anarres/cpp/CppReaderTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/anarres/cpp/CppReaderTest.java')
-rw-r--r--src/test/java/org/anarres/cpp/CppReaderTest.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/java/org/anarres/cpp/CppReaderTest.java b/src/test/java/org/anarres/cpp/CppReaderTest.java
new file mode 100644
index 0000000..27eba06
--- /dev/null
+++ b/src/test/java/org/anarres/cpp/CppReaderTest.java
@@ -0,0 +1,34 @@
+package org.anarres.cpp;
+
+import java.util.Collections;
+
+import java.io.StringReader;
+import java.io.BufferedReader;
+import org.junit.Test;
+
+public class CppReaderTest {
+
+ private void testCppReader(String in, String out)
+ throws Exception {
+ System.out.println("Testing " + in + " => " + out);
+ StringReader r = new StringReader(in);
+ CppReader p = new CppReader(r);
+ p.getPreprocessor().setSystemIncludePath(
+ Collections.singletonList("src/test/resources")
+ );
+ p.getPreprocessor().getFeatures().add(Feature.LINEMARKERS);
+ BufferedReader b = new BufferedReader(p);
+
+ String line;
+ while ((line = b.readLine()) != null) {
+ System.out.println(" >> " + line);
+ }
+ }
+
+ @Test
+ public void testCppReader()
+ throws Exception {
+ testCppReader("#include <test0.h>\n", "ab");
+ }
+
+}