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 | 4 |
5 /// End-to-end test of the dart2dart compiler. | 5 /// End-to-end test of the dart2dart compiler. |
6 library dart_backend.end2end_test; | 6 library dart_backend.end2end_test; |
7 | 7 |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:compiler/src/dart2jslib.dart'; | 9 import 'package:compiler/implementation/dart2jslib.dart'; |
10 import 'package:compiler/src/dart_backend/dart_backend.dart'; | 10 import 'package:compiler/implementation/dart_backend/dart_backend.dart'; |
11 import 'package:expect/expect.dart'; | 11 import 'package:expect/expect.dart'; |
12 | 12 |
13 import '../../../../pkg/analyzer2dart/test/test_helper.dart' hide TestSpec; | 13 import '../../../../pkg/analyzer2dart/test/test_helper.dart' hide TestSpec; |
14 import '../../../../pkg/analyzer2dart/test/end2end_data.dart'; | 14 import '../../../../pkg/analyzer2dart/test/end2end_data.dart'; |
15 | 15 |
16 import 'test_helper.dart'; | 16 import 'test_helper.dart'; |
17 | 17 |
18 main() { | 18 main() { |
19 performTests(TEST_DATA, asyncTester, (TestSpec result) { | 19 performTests(TEST_DATA, asyncTester, (TestSpec result) { |
20 asyncTest(() => compilerFor(result.input).then((Compiler compiler) { | 20 asyncTest(() => compilerFor(result.input).then((Compiler compiler) { |
21 String expectedOutput = result.output.trim(); | 21 String expectedOutput = result.output.trim(); |
22 compiler.phase = Compiler.PHASE_COMPILING; | 22 compiler.phase = Compiler.PHASE_COMPILING; |
23 DartBackend backend = compiler.backend; | 23 DartBackend backend = compiler.backend; |
24 backend.assembleProgram(); | 24 backend.assembleProgram(); |
25 String output = compiler.assembledCode.trim(); | 25 String output = compiler.assembledCode.trim(); |
26 Expect.equals(expectedOutput, output, | 26 Expect.equals(expectedOutput, output, |
27 '\nInput:\n${result.input}\n' | 27 '\nInput:\n${result.input}\n' |
28 'Expected:\n$expectedOutput\n' | 28 'Expected:\n$expectedOutput\n' |
29 'Actual:\n$output\n'); | 29 'Actual:\n$output\n'); |
30 })); | 30 })); |
31 }); | 31 }); |
32 } | 32 } |
OLD | NEW |