vlsi commented on a change in pull request #2409:
URL: https://github.com/apache/calcite/pull/2409#discussion_r626012880
##########
File path: core/src/test/java/org/apache/calcite/test/DiffRepository.java
##########
@@ -217,9 +235,29 @@ private DiffRepository(
} catch (ParserConfigurationException | SAXException e) {
throw new RuntimeException("error while creating xml parser", e);
}
- indent = logFile.getPath().contains("RelOptRulesTest")
- || logFile.getPath().contains("SqlToRelConverterTest")
- || logFile.getPath().contains("SqlLimitsTest") ? 4 : 2;
+
+ // Test cases should be sorted, but we allow exceptions.
+ // Figure out which test cases are out of order.
+ final List<String> names = new ArrayList<>();
+ for (Node testCase : iterate(root.getElementsByTagName("TestCase"))) {
+ if (testCase instanceof Element) {
+ names.add(((Element) testCase).getAttribute(TEST_CASE_NAME_ATTR));
+ }
+ }
+ final SortedSet<String> outOfOrderTests = TestUtil.outOfOrderItems(names);
+ this.unexpectedOutOfOrderTests =
+ ImmutableSortedSet.copyOf(Ordering.natural(),
+ Sets.difference(outOfOrderTests,
+ new HashSet<>(expectedOutOfOrderTests)));
+ final boolean debug = false;
+ if (debug) {
+ final Set<String> inOrderNames = new TreeSet<>(expectedOutOfOrderTests);
+ inOrderNames.removeAll(outOfOrderTests);
+ if (!inOrderNames.isEmpty()) {
+ throw new IllegalArgumentException("some names were expected to be out
"
+ + "of order but were not: " + toLiteralArray(inOrderNames));
Review comment:
Does this ever trigger? What does "names were expected to be out of
order" mean? We expect only "in order" names.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]