summaryrefslogtreecommitdiffstats
path: root/src/tests/org/anarres/cpp/CppReaderTestCase.java
blob: 60974369654b191221d96cafcb8b53a7140bad57 (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().getFeatures().add(Feature.LINEMARKERS);
		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");
	}

}