SQL: Fail on trailing test specs (elastic/x-pack-elasticsearch#2836)
If you wrote a test at the end of one of SQL's test spec files that was just a name without a body then the parser would throw the test away. Now it fails to intiaize the class with an error message telling you which file is broken. Original commit: elastic/x-pack-elasticsearch@023a942ca3
This commit is contained in:
parent
44dc98385a
commit
49b295296e
|
@ -147,8 +147,7 @@ public abstract class SpecBaseIntegrationTestCase extends JdbcIntegrationTestCas
|
|||
testName = Strings.capitalize(line);
|
||||
testNames.put(testName, Integer.valueOf(lineNumber));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Object result = parser.parse(line);
|
||||
// only if the parser is ready, add the object - otherwise keep on serving it lines
|
||||
if (result != null) {
|
||||
|
@ -156,10 +155,12 @@ public abstract class SpecBaseIntegrationTestCase extends JdbcIntegrationTestCas
|
|||
testName = null;
|
||||
}
|
||||
}
|
||||
// NOCOMMIT be more careful on the last line
|
||||
}
|
||||
lineNumber++;
|
||||
}
|
||||
if (testName != null) {
|
||||
throw new IllegalStateException("Read a test without a body at the end of [" + fileName + "].");
|
||||
}
|
||||
}
|
||||
assertNull("Cannot find spec for test " + testName, testName);
|
||||
|
||||
|
|
Loading…
Reference in New Issue