| 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. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 ..writeln('/// ---- AUTOGENERATED: DO NOT EDIT THIS FILE --------------') | 129 ..writeln('/// ---- AUTOGENERATED: DO NOT EDIT THIS FILE --------------') |
| 130 ..writeln('/// To update this test file, call:') | 130 ..writeln('/// To update this test file, call:') |
| 131 ..writeln('/// > dart codegen/end_to_end_test.dart --update_static_test') | 131 ..writeln('/// > dart codegen/end_to_end_test.dart --update_static_test') |
| 132 ..writeln('/// --------------------------------------------------------') | 132 ..writeln('/// --------------------------------------------------------') |
| 133 ..writeln('\nlibrary smoke.test.static_test;\n') | 133 ..writeln('\nlibrary smoke.test.static_test;\n') |
| 134 ..writeln("import 'package:unittest/unittest.dart';"); | 134 ..writeln("import 'package:unittest/unittest.dart';"); |
| 135 | 135 |
| 136 generator.writeImports(sb); | 136 generator.writeImports(sb); |
| 137 sb.writeln("import 'common.dart' as common show main;\n"); | 137 sb.writeln("import 'common.dart' as common show main;\n"); |
| 138 generator.writeTopLevelDeclarations(sb); | 138 generator.writeTopLevelDeclarations(sb); |
| 139 sb.writeln('\n_configure() {'); | 139 sb.write('\nfinal configuration = '); |
| 140 generator.writeInitCall(sb); | 140 generator.writeStaticConfiguration(sb, 0); |
| 141 | 141 |
| 142 sb..writeln('}\n') | 142 sb..writeln(';\n') |
| 143 ..writeln('main() {') | 143 ..writeln('main() {') |
| 144 ..writeln(' setUp(_configure);') | 144 ..writeln(' setUp(() => useGeneratedCode(configuration));') |
| 145 ..writeln(' common.main();') | 145 ..writeln(' common.main();') |
| 146 ..writeln('}'); | 146 ..writeln('}'); |
| 147 return sb.toString(); | 147 return sb.toString(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 _resolveImportUrl(LibraryElement lib) { | 150 _resolveImportUrl(LibraryElement lib) { |
| 151 if (lib.isDartCore) return 'dart:core'; | 151 if (lib.isDartCore) return 'dart:core'; |
| 152 if (lib.displayName == 'smoke.test.common') return 'common.dart'; | 152 if (lib.displayName == 'smoke.test.common') return 'common.dart'; |
| 153 return 'unknown.dart'; | 153 return 'unknown.dart'; |
| 154 } | 154 } |
| OLD | NEW |