some automation in NamespaceComparator
This commit is contained in:
@@ -70,13 +70,19 @@ class NamespaceComparator {
|
|||||||
@NotNull File txtFile) {
|
@NotNull File txtFile) {
|
||||||
String serialized = new NamespaceComparator(includeObject).doCompareNamespaces(nsa, nsb);
|
String serialized = new NamespaceComparator(includeObject).doCompareNamespaces(nsa, nsb);
|
||||||
try {
|
try {
|
||||||
// change to true to regenerate files if format changes
|
for (;;) {
|
||||||
if (false) {
|
|
||||||
Files.write(serialized, txtFile, Charset.forName("utf-8"));
|
|
||||||
} else {
|
|
||||||
String expected = Files.toString(txtFile, Charset.forName("utf-8")).replace("\r\n", "\n");
|
String expected = Files.toString(txtFile, Charset.forName("utf-8")).replace("\r\n", "\n");
|
||||||
|
|
||||||
|
if (expected.contains("kick me")) {
|
||||||
|
// for developer
|
||||||
|
System.err.println("generating " + txtFile);
|
||||||
|
Files.write(serialized, txtFile, Charset.forName("utf-8"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// compare with hardcopy: make sure nothing is lost in output
|
// compare with hardcopy: make sure nothing is lost in output
|
||||||
Assert.assertEquals(expected, serialized);
|
Assert.assertEquals(expected, serialized);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user