1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixed breakage of lrparser and xlc tests.

This commit is contained in:
Sergey Prigogin 2012-01-04 11:17:04 -08:00
parent 83a8040a2b
commit b83af889fb

View file

@ -70,7 +70,19 @@ public class TestSourceReader {
*/
public static StringBuilder[] getContentsForTest(Bundle bundle, String srcRoot, Class clazz,
final String testName, int sections) throws IOException {
// Walk up the class inheritance chain until we find the test method.
try {
while (clazz.getMethod(testName).getDeclaringClass() != clazz) {
clazz = clazz.getSuperclass();
}
} catch (SecurityException e) {
Assert.fail(e.getMessage());
} catch (NoSuchMethodException e) {
Assert.fail(e.getMessage());
}
while (true) {
// Find and open the .java file for the class clazz.
String fqn = clazz.getName().replace('.', '/');
fqn = fqn.indexOf("$") == -1 ? fqn : fqn.substring(0, fqn.indexOf("$"));
String classFile = fqn + ".java";
@ -94,6 +106,7 @@ public class TestSourceReader {
BufferedReader br = new BufferedReader(new InputStreamReader(in));
try {
// Read the java file collecting comments until we encounter the test method.
List<StringBuilder> contents = new ArrayList<StringBuilder>();
StringBuilder content = new StringBuilder();
for (String line = br.readLine(); line != null; line = br.readLine()) {