| 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..80398fe41c7498ac62d14768b7771079877d537c
|
| --- /dev/null
|
| +++ b/tests/compiler/dart2js/js_backend_cps_ir_test.dart
|
| @@ -0,0 +1,45 @@
|
| +// 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 'package:compiler/src/apiimpl.dart'
|
| + show Compiler;
|
| +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"));
|
| +
|
| + Iterable<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.isNotNull(compiler.assembledCode);
|
| + }).catchError((e) {
|
| + Expect.fail('The following test failed to compile:\n'
|
| + '${formatTest(test)}');
|
| + });
|
| + });
|
| + }
|
| +}
|
|
|