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

Unified Diff: tests/standalone/status_expression_test.dart

Issue 2984203002: Move the status file parser into its own package. (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « tests/standalone/standalone.status ('k') | tools/testing/dart/command.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/status_expression_test.dart
diff --git a/tests/standalone/status_expression_test.dart b/tests/standalone/status_expression_test.dart
deleted file mode 100644
index fbf7b1d696466d7dd0fa405e01d4f03ae60be308..0000000000000000000000000000000000000000
--- a/tests/standalone/status_expression_test.dart
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "package:expect/expect.dart";
-
-import "../../tools/testing/dart/environment.dart";
-import "../../tools/testing/dart/status_expression.dart";
-
-class TestEnvironment implements Environment {
- final Map<String, String> _values;
-
- TestEnvironment(this._values);
-
- /// Looks up the value of the variable with [name].
- String lookUp(String name) => _values[name];
-
- operator []=(String key, String value) => _values[key] = value;
-}
-
-main() {
- testExpression();
- testSyntaxError();
- testBoolean();
- testNotBoolean();
- testNotEqual();
-}
-
-void testExpression() {
- var expression = Expression
- .parse(r" $mode == debug && ($arch == chromium || $arch == dartc) ");
- Expect.equals(
- r"(($mode == debug) && (($arch == chromium) || ($arch == dartc)))",
- expression.toString());
-
- // Test BooleanExpression.evaluate().
- var environment = new TestEnvironment({"arch": "dartc", "mode": "debug"});
-
- Expect.isTrue(expression.evaluate(environment));
- environment["mode"] = "release";
- Expect.isFalse(expression.evaluate(environment));
- environment["arch"] = "ia32";
- Expect.isFalse(expression.evaluate(environment));
- environment["mode"] = "debug";
- Expect.isFalse(expression.evaluate(environment));
- environment["arch"] = "chromium";
- Expect.isTrue(expression.evaluate(environment));
-}
-
-void testSyntaxError() {
- var input = r"($arch == (-dartc || $arch == chromium) && $mode == release";
- Expect.throws(() {
- Expression.parse(input);
- }, (e) => e.toString() == "FormatException: Syntax error in '$input'");
-}
-
-void testBoolean() {
- var expression =
- Expression.parse(r" $arch == ia32 && $checked || $mode == release ");
- Expect.equals(r"((($arch == ia32) && (bool $checked)) || ($mode == release))",
- expression.toString());
-
- // Test BooleanExpression.evaluate().
- var environment =
- new TestEnvironment({"arch": "ia32", "checked": "true", "mode": "debug"});
-
- Expect.isTrue(expression.evaluate(environment));
- environment["mode"] = "release";
- Expect.isTrue(expression.evaluate(environment));
- environment["checked"] = "false";
- Expect.isTrue(expression.evaluate(environment));
- environment["mode"] = "debug";
- Expect.isFalse(expression.evaluate(environment));
- environment["arch"] = "arm";
- Expect.isFalse(expression.evaluate(environment));
- environment["checked"] = "true";
- Expect.isFalse(expression.evaluate(environment));
-}
-
-void testNotBoolean() {
- var expression =
- Expression.parse(r" $arch == ia32 && ! $checked || $mode == release ");
- Expect.equals(
- r"((($arch == ia32) && (bool ! $checked)) || ($mode == release))",
- expression.toString());
-
- var environment = new TestEnvironment(
- {"arch": "ia32", "checked": "false", "mode": "debug"});
-
- Expect.isTrue(expression.evaluate(environment));
- environment["mode"] = "release";
- Expect.isTrue(expression.evaluate(environment));
- environment["checked"] = "true";
- Expect.isTrue(expression.evaluate(environment));
- environment["mode"] = "debug";
- Expect.isFalse(expression.evaluate(environment));
- environment["arch"] = "arm";
- Expect.isFalse(expression.evaluate(environment));
- environment["checked"] = "false";
- Expect.isFalse(expression.evaluate(environment));
-}
-
-void testNotEqual() {
- // Test the != operator.
- var expression = Expression.parse(r"$compiler == dart2js && $runtime != ie9");
- Expect.equals(
- r"(($compiler == dart2js) && ($runtime != ie9))", expression.toString());
-
- // Test BooleanExpression.evaluate().
- var environment = new TestEnvironment({
- "compiler": "none",
- "runtime": "ie9",
- });
-
- Expect.isFalse(expression.evaluate(environment));
- environment["runtime"] = "chrome";
- Expect.isFalse(expression.evaluate(environment));
-
- environment["compiler"] = "dart2js";
- environment["runtime"] = "ie9";
- Expect.isFalse(expression.evaluate(environment));
- environment["runtime"] = "chrome";
- Expect.isTrue(expression.evaluate(environment));
-}
« no previous file with comments | « tests/standalone/standalone.status ('k') | tools/testing/dart/command.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698