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 /// And end-to-end test that generates code and checks that the output matches | 5 /// And end-to-end test that generates code and checks that the output matches |
6 /// the code in `static_test.dart`. Techincally we could run the result in an | 6 /// the code in `static_test.dart`. Techincally we could run the result in an |
7 /// isolate, but instead we decided to split that up in two tests. This test | 7 /// isolate, but instead we decided to split that up in two tests. This test |
8 /// ensures that we generate the code as it was written in static_test, and | 8 /// ensures that we generate the code as it was written in static_test, and |
9 /// separately static_test ensures that the smoke.static library behaves as | 9 /// separately static_test ensures that the smoke.static library behaves as |
10 /// expected. | 10 /// expected. |
11 @TestOn('vm') | 11 @TestOn('vm') |
12 library smoke.test.codegen.end_to_end_test; | 12 library smoke.test.codegen.end_to_end_test; |
13 | 13 |
14 import 'dart:io'; | 14 import 'dart:io'; |
15 | 15 |
16 import 'package:analyzer/src/generated/element.dart'; | 16 import 'package:analyzer/dart/element/element.dart'; |
17 import 'package:smoke/codegen/generator.dart'; | 17 import 'package:smoke/codegen/generator.dart'; |
18 import 'package:smoke/codegen/recorder.dart'; | 18 import 'package:smoke/codegen/recorder.dart'; |
19 import 'package:test/test.dart'; | 19 import 'package:test/test.dart'; |
20 import 'package:path/path.dart' as path; | 20 import 'package:path/path.dart' as path; |
21 | 21 |
22 import 'testing_resolver_utils.dart' show initAnalyzer; | 22 import 'testing_resolver_utils.dart' show initAnalyzer; |
23 | 23 |
24 void main([List<String> args]) { | 24 void main([List<String> args]) { |
25 final updateStaticTest = | 25 final updateStaticTest = |
26 args != null && args.length > 0 && args[0] == '--update_static_test'; | 26 args != null && args.length > 0 && args[0] == '--update_static_test'; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ..writeln(' common.main();') | 155 ..writeln(' common.main();') |
156 ..writeln('}'); | 156 ..writeln('}'); |
157 return sb.toString(); | 157 return sb.toString(); |
158 } | 158 } |
159 | 159 |
160 String _resolveImportUrl(LibraryElement lib) { | 160 String _resolveImportUrl(LibraryElement lib) { |
161 if (lib.isDartCore) return 'dart:core'; | 161 if (lib.isDartCore) return 'dart:core'; |
162 if (lib.displayName == 'smoke.test.common') return 'common.dart'; | 162 if (lib.displayName == 'smoke.test.common') return 'common.dart'; |
163 return 'unknown.dart'; | 163 return 'unknown.dart'; |
164 } | 164 } |
OLD | NEW |