Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Unified Diff: tests/standalone/status_expression_test.dart

Issue 2913963002: Add negation to single-identifier tests in status files. (Closed)
Patch Set: Document the isIdentifier optimization. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/standalone/status_expression_test.dart
diff --git a/tests/standalone/status_expression_test.dart b/tests/standalone/status_expression_test.dart
index a16c746d8d596c6b19063910600a296b60e53b0d..0cea061319091d05572d567d33876ffa6f33d4f0 100644
--- a/tests/standalone/status_expression_test.dart
+++ b/tests/standalone/status_expression_test.dart
@@ -22,6 +22,7 @@ main() {
testExpression();
testSyntaxError();
testBoolean();
+ testNotBoolean();
testNotEqual();
}
@@ -76,6 +77,32 @@ void testBoolean() {
Expect.isFalse(expression.evaluate(environment));
}
+void testNotBoolean() {
+ var expression =
+ Expression.parse(r" $arch == ia32 && ! $unchecked || $mode == release ");
+ Expect.equals(
+ r"((($arch == ia32) && (bool ! $unchecked)) || ($mode == release))",
+ expression.toString());
+
+ var environment = <String, dynamic>{
Bob Nystrom 2017/06/01 23:07:46 This map needs to be wrapped in new TestEnvironmen
Lasse Reichstein Nielsen 2017/06/07 08:51:48 Done.
+ "arch": "ia32",
+ "unchecked": false,
Bob Nystrom 2017/06/01 23:07:45 Nit: Would you mind using "checked" for this? It
Lasse Reichstein Nielsen 2017/06/07 08:51:48 Sure. This was just the "minimal diff" from the te
+ "mode": "debug"
+ };
+
+ Expect.isTrue(expression.evaluate(environment));
+ environment["mode"] = "release";
+ Expect.isTrue(expression.evaluate(environment));
+ environment["unchecked"] = true;
Bob Nystrom 2017/06/01 23:07:45 "true" and "false" need to be explicitly stringifi
Lasse Reichstein Nielsen 2017/06/07 08:51:48 Done.
+ Expect.isTrue(expression.evaluate(environment));
+ environment["mode"] = "debug";
+ Expect.isFalse(expression.evaluate(environment));
+ environment["arch"] = "arm";
+ Expect.isFalse(expression.evaluate(environment));
+ environment["unchecked"] = false;
+ Expect.isFalse(expression.evaluate(environment));
+}
+
void testNotEqual() {
// Test the != operator.
var expression = Expression.parse(r"$compiler == dart2js && $runtime != ie9");

Powered by Google App Engine
This is Rietveld 408576698