Chromium Code Reviews| Index: tests/compiler/dart2js/js_backend_cps_ir_test.dart |
| diff --git a/tests/compiler/dart2js/js_backend_cps_ir_test.dart b/tests/compiler/dart2js/js_backend_cps_ir_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5bf95abb7785286602ae5f88aa0a7f9f0b1283aa |
| --- /dev/null |
| +++ b/tests/compiler/dart2js/js_backend_cps_ir_test.dart |
| @@ -0,0 +1,44 @@ |
| +// Copyright (c) 2014, 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. |
| +// VMOptions=-DUSE_CPS_IR=true |
| + |
| +// Test that the CPS IR code generator is able to compile the provided |
| +// example programs. |
| + |
| +import 'package:async_helper/async_helper.dart'; |
| +import 'package:expect/expect.dart'; |
| +import 'memory_compiler.dart'; |
| + |
| +const String TEST_MAIN_FILE = 'test.dart'; |
| + |
| +/// The list of tests to run. |
| +const List<String> RAW_TESTS = const [ |
| + "main() {}", |
| + "main() { return 42; }", |
| +]; |
| + |
| +String formatTest(Map test) { |
| + return test[TEST_MAIN_FILE]; |
| +} |
| + |
| +main() { |
| + Expect.isTrue(const bool.fromEnvironment("USE_CPS_IR")); |
| + |
| + List<Map> tests = |
| + RAW_TESTS.map((String text) => {TEST_MAIN_FILE: text}); |
| + |
| + for (Map test in tests) { |
| + asyncTest(() { |
| + Compiler compiler = compilerFor(test); |
| + Uri uri = Uri.parse('memory:$TEST_MAIN_FILE'); |
| + return compiler.run(uri).then((_) { |
| + Expect.isTrue(compiler.assembledCode != null); |
|
floitsch
2014/11/17 15:03:30
Expect.isNotNull(...)
floitsch
2014/11/17 15:03:30
indent+, or indent- in the next line.
karlklose
2014/11/17 16:11:58
Done.
karlklose
2014/11/17 16:11:58
Done.
|
| + }).catchError((_) { |
| + print('The following test failed to compile:\n' |
| + '${formatTest(test)}'); |
| + Expect.isTrue(false); |
|
floitsch
2014/11/17 15:03:30
Expect.fail(...)
karlklose
2014/11/17 16:11:58
Done.
|
| + }); |
| + }); |
| + } |
| +} |