Tests that use XML resources managed via class DiffRepository should fail if the XML resources are not in alphabetical order.
First, some background. Quite a few tests store resources in an XML file, accessed via class DiffRepository. For example, RelOptRulesTest stores the plan before and after the rule(s) that it is testing are fired. The resources are organized by test case name, enclosed in <TestCase> elements.
Contributors have a tendency to add test resources at the end of the file. But this makes the end of the file a hot-spot for conflicts.
Therefore the best practice is to put the resources into alphabetical order. DiffRepository tries to help with this, by generating an _actual.xml file with the new resource in inserted in its right alphabetical position, but contributors somehow miss this, and write the file by hand. So, conflicts.
With this change, a test will fail if resources are out of order. The message will look something like this:
Why does it say "expected 10 test case to be out of order, but there were 11"? Because resource files are not currently in total order: they were not sorted to start with, and we don't want to destroy history by sorting them. But to solve the conflict problem, we only need new test cases to be in order. So, this change adds a list of exceptions - test cases that are known to be out of order - and DiffRepository will not complain if those test cases are out of order. Over time, the sort order of resource files will get better, or at least will not get any worse.