Changes related to the order of Skylark dictionaries:
- Objects of different types can now be compared.
- Printer now prints dictionaries in a deterministic order, even when the keys have different types.
- testEval() in EvaluationTestCases evaluates both expressions instead of comparing expression strings. Consequently, if a statement describes a collection, its order does no longer matter when doing the comparison.
--
MOS_MIGRATED_REVID=99829458
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTestCase.java b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTestCase.java
index 692a338..7be1c86 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTestCase.java
@@ -367,13 +367,15 @@
@Override
public void run() throws Exception {
Object actual = eval(statement);
+ Object realExpected = expected;
- // Prints the actual object instead of evaluating the expected expression
+ // We could also print the actual object and compare the string to the expected
+ // expression, but then the order of elements would matter.
if (expectedIsExpression) {
- actual = Printer.repr(actual, '\'');
+ realExpected = eval((String) expected);
}
- assertThat(actual).isEqualTo(expected);
+ assertThat(actual).isEqualTo(realExpected);
}
};
}