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

Unified Diff: tests/compiler/dart2js/const_exp_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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/compiler/dart2js/const_exp_test.dart
diff --git a/tests/compiler/dart2js/const_exp_test.dart b/tests/compiler/dart2js/const_exp_test.dart
index f45794c3a9b1c1fdae97a87a334a44fef417334d..a903a62a62c65391229cf74f9be0edd9855cad65 100644
--- a/tests/compiler/dart2js/const_exp_test.dart
+++ b/tests/compiler/dart2js/const_exp_test.dart
@@ -11,7 +11,9 @@ test(String constantInitializer, [String expectedOutput]) {
if (expectedOutput == null) {
expectedOutput = constantInitializer;
}
- return () => TypeEnvironment.create("""
+ return () => TypeEnvironment
+ .create(
+ """
class Class<T, S> {
final a;
final b;
@@ -27,79 +29,83 @@ test(String constantInitializer, [String expectedOutput]) {
const toplevelConstant = 0;
toplevelFunction() {}
const constant = $constantInitializer;
-""", expectNoWarningsOrErrors: true).then((env) {
- var element = env.getElement('constant');
- Expect.isNotNull(element, "Element 'constant' not found.");
- var constant = element.constant;
- var value = env.compiler.constants.getConstantValue(constant);
- Expect.isNotNull(constant,
- "No constant computed for '$element'.");
- Expect.equals(expectedOutput, constant.toDartText(),
- "Unexpected to string '${constant.toDartText()}' for constant "
- "'$constantInitializer' of value "
- "${value.toStructuredText()}");
- });
+""",
+ expectNoWarningsOrErrors: true)
+ .then((env) {
+ var element = env.getElement('constant');
+ Expect.isNotNull(element, "Element 'constant' not found.");
+ var constant = element.constant;
+ var value = env.compiler.constants.getConstantValue(constant);
+ Expect.isNotNull(constant, "No constant computed for '$element'.");
+ Expect.equals(
+ expectedOutput,
+ constant.toDartText(),
+ "Unexpected to string '${constant.toDartText()}' for constant "
+ "'$constantInitializer' of value "
+ "${value.toStructuredText()}");
+ });
}
void main() {
asyncTest(() => Future.forEach([
- test('null'),
- test('0'),
- test('1.5'),
- test('true'),
- test('false'),
- test('"f"'),
- test('"a" "b"', '"ab"'),
- test('const []'),
- test('const <int>[0, 1]'),
- test('const <dynamic>[0, 1]', 'const [0, 1]'),
- test('const {}'),
- test('const {0: 1, 2: 3}'),
- test('const <String, int>{"0": 1, "2": 3}'),
- test('const <String, dynamic>{"0": 1, "2": 3}'),
- test('const <dynamic, dynamic>{"0": 1, "2": 3}', 'const {"0": 1, "2": 3}'),
- test('const Class(0)'),
- test('const Class(0, b: 1)'),
- test('const Class(0, c: 2)'),
- test('const Class(0, b: 3, c: 4)'),
- test('const Class.named()'),
- test('const Class.named(0)'),
- test('const Class.named(0, 1)'),
- test('const Class.named(0, 1, 2)'),
- test('const Class<String, int>(0)'),
- test('const Class<String, dynamic>(0)'),
- test('const Class<dynamic, String>(0)'),
- test('const Class<dynamic, dynamic>(0)', 'const Class(0)'),
- test('toplevelConstant'),
- test('toplevelFunction'),
- test('Class.staticConstant'),
- test('Class.staticFunction'),
- test('#a'),
- test('1 + 2'),
- test('1 + 2 + 3'),
- test('1 + -2'),
- test('-1 + 2'),
- test('(1 + 2) + 3', '1 + 2 + 3'),
- test('1 + (2 + 3)', '1 + 2 + 3'),
- test('1 * 2'),
- test('1 * 2 + 3'),
- test('1 * (2 + 3)'),
- test('1 + 2 * 3'),
- test('(1 + 2) * 3'),
- test('false || identical(0, 1)'),
- test('!identical(0, 1)'),
- test('!identical(0, 1) || false'),
- test('!(identical(0, 1) || false)'),
- test('identical(0, 1) ? 3 * 4 + 5 : 6 + 7 * 8'),
- test('t ? f ? 0 : 1 : 2'),
- test('(t ? t : f) ? f ? 0 : 1 : 2'),
- test('t ? t : f ? f ? 0 : 1 : 2'),
- test('t ? t ? t : t : t ? t : t'),
- test('t ? (t ? t : t) : (t ? t : t)',
- 't ? t ? t : t : t ? t : t'),
- test('const [const <dynamic, dynamic>{0: true, "1": "c" "d"}, '
- 'const Class(const Class<dynamic, dynamic>(toplevelConstant))]',
- 'const [const {0: true, "1": "cd"}, '
- 'const Class(const Class(toplevelConstant))]'),
- ], (f) => f()));
-}
+ test('null'),
+ test('0'),
+ test('1.5'),
+ test('true'),
+ test('false'),
+ test('"f"'),
+ test('"a" "b"', '"ab"'),
+ test('const []'),
+ test('const <int>[0, 1]'),
+ test('const <dynamic>[0, 1]', 'const [0, 1]'),
+ test('const {}'),
+ test('const {0: 1, 2: 3}'),
+ test('const <String, int>{"0": 1, "2": 3}'),
+ test('const <String, dynamic>{"0": 1, "2": 3}'),
+ test('const <dynamic, dynamic>{"0": 1, "2": 3}',
+ 'const {"0": 1, "2": 3}'),
+ test('const Class(0)'),
+ test('const Class(0, b: 1)'),
+ test('const Class(0, c: 2)'),
+ test('const Class(0, b: 3, c: 4)'),
+ test('const Class.named()'),
+ test('const Class.named(0)'),
+ test('const Class.named(0, 1)'),
+ test('const Class.named(0, 1, 2)'),
+ test('const Class<String, int>(0)'),
+ test('const Class<String, dynamic>(0)'),
+ test('const Class<dynamic, String>(0)'),
+ test('const Class<dynamic, dynamic>(0)', 'const Class(0)'),
+ test('toplevelConstant'),
+ test('toplevelFunction'),
+ test('Class.staticConstant'),
+ test('Class.staticFunction'),
+ test('#a'),
+ test('1 + 2'),
+ test('1 + 2 + 3'),
+ test('1 + -2'),
+ test('-1 + 2'),
+ test('(1 + 2) + 3', '1 + 2 + 3'),
+ test('1 + (2 + 3)', '1 + 2 + 3'),
+ test('1 * 2'),
+ test('1 * 2 + 3'),
+ test('1 * (2 + 3)'),
+ test('1 + 2 * 3'),
+ test('(1 + 2) * 3'),
+ test('false || identical(0, 1)'),
+ test('!identical(0, 1)'),
+ test('!identical(0, 1) || false'),
+ test('!(identical(0, 1) || false)'),
+ test('identical(0, 1) ? 3 * 4 + 5 : 6 + 7 * 8'),
+ test('t ? f ? 0 : 1 : 2'),
+ test('(t ? t : f) ? f ? 0 : 1 : 2'),
+ test('t ? t : f ? f ? 0 : 1 : 2'),
+ test('t ? t ? t : t : t ? t : t'),
+ test('t ? (t ? t : t) : (t ? t : t)', 't ? t ? t : t : t ? t : t'),
+ test(
+ 'const [const <dynamic, dynamic>{0: true, "1": "c" "d"}, '
+ 'const Class(const Class<dynamic, dynamic>(toplevelConstant))]',
+ 'const [const {0: true, "1": "cd"}, '
+ 'const Class(const Class(toplevelConstant))]'),
+ ], (f) => f()));
+}

Powered by Google App Engine
This is Rietveld 408576698