| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // VMOptions=-DUSE_CPS_IR=true | 4 // VMOptions=-DUSE_CPS_IR=true |
| 5 | 5 |
| 6 // Test that the CPS IR code generator compiles programs and produces the | 6 // Test that the CPS IR code generator compiles programs and produces the |
| 7 // the expected output. | 7 // the expected output. |
| 8 | 8 |
| 9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
| 10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
| 11 import 'package:compiler/src/apiimpl.dart' | 11 import 'package:compiler/src/apiimpl.dart' |
| 12 show Compiler; | 12 show Compiler; |
| 13 import 'memory_compiler.dart'; | 13 import 'memory_compiler.dart'; |
| 14 import 'package:compiler/src/js/js.dart' as js; | 14 import 'package:compiler/src/js/js.dart' as js; |
| 15 import 'package:compiler/src/common.dart' show Element; | 15 import 'package:compiler/src/common.dart' show Element; |
| 16 | 16 |
| 17 import 'js_backend_cps_ir_basic.dart' as basic; | 17 import 'js_backend_cps_ir_basic.dart' as basic; |
| 18 import 'js_backend_cps_ir_literals.dart' as literals; | 18 import 'js_backend_cps_ir_literals.dart' as literals; |
| 19 import 'js_backend_cps_ir_operators.dart' as operators; | 19 import 'js_backend_cps_ir_operators.dart' as operators; |
| 20 import 'js_backend_cps_ir_control_flow.dart' as control_flow; |
| 20 | 21 |
| 21 const String TEST_MAIN_FILE = 'test.dart'; | 22 const String TEST_MAIN_FILE = 'test.dart'; |
| 22 | 23 |
| 23 List<TestEntry> tests = <TestEntry>[] | 24 List<TestEntry> tests = <TestEntry>[] |
| 24 ..addAll(basic.tests) | 25 ..addAll(basic.tests) |
| 25 ..addAll(literals.tests) | 26 ..addAll(literals.tests) |
| 27 ..addAll(control_flow.tests) |
| 26 ..addAll(operators.tests); | 28 ..addAll(operators.tests); |
| 27 | 29 |
| 28 class TestEntry { | 30 class TestEntry { |
| 29 final String source; | 31 final String source; |
| 30 final String expectation; | 32 final String expectation; |
| 31 const TestEntry(this.source, [this.expectation]); | 33 const TestEntry(this.source, [this.expectation]); |
| 32 } | 34 } |
| 33 | 35 |
| 34 String formatTest(Map test) { | 36 String formatTest(Map test) { |
| 35 return test[TEST_MAIN_FILE]; | 37 return test[TEST_MAIN_FILE]; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 60 } | 62 } |
| 61 } | 63 } |
| 62 }).catchError((e) { | 64 }).catchError((e) { |
| 63 print(e); | 65 print(e); |
| 64 Expect.fail('The following test failed to compile:\n' | 66 Expect.fail('The following test failed to compile:\n' |
| 65 '${formatTest(files)}'); | 67 '${formatTest(files)}'); |
| 66 }); | 68 }); |
| 67 }); | 69 }); |
| 68 } | 70 } |
| 69 } | 71 } |
| OLD | NEW |