summaryrefslogtreecommitdiffstats
path: root/src/tests/org/anarres/cpp/CppReaderTestCase.java
blob: 5aeee066c10a3b960fdf7871d7e1018bfb5a7d11 (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
package org.anarres.cpp;

import java.util.Collections;

import java.io.StringReader;
import java.io.BufferedReader;

import junit.framework.Test;

public class CppReaderTestCase extends BaseTestCase implements Test {

	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().setIncludePath(
				Collections.singletonList("src/input")
					);
		p.getPreprocessor().setFlags(Preprocessor.FL_LINEMARKER);
		BufferedReader	b = new BufferedReader(p);

		String	line;
		while ((line = b.readLine()) != null) {
			System.out.println(" >> " + line);
		}
	}

	public void testJoinReader()
						throws Exception {
		testCppReader("#include <test0.h>\n", "ab");
	}

}