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 // Test of LibraryUpdater (one compilation unit per library). | 5 // Test of LibraryUpdater (one compilation unit per library). |
6 library trydart.library_updater_test; | 6 library trydart.library_updater_test; |
7 | 7 |
8 import 'package:dart2js_incremental/library_updater.dart' show | 8 import 'package:dart2js_incremental/library_updater.dart' show |
9 IncrementalCompilerContext, | 9 IncrementalCompilerContext, |
10 LibraryUpdater, | 10 LibraryUpdater, |
11 Update; | 11 Update; |
12 | 12 |
13 import 'package:compiler/src/dart2jslib.dart' show | 13 import 'package:compiler/src/dart2jslib.dart' show |
14 Script; | 14 Script; |
15 | 15 |
16 import 'package:compiler/src/io/source_file.dart' show | 16 import 'package:compiler/src/io/source_file.dart' show |
17 StringSourceFile; | 17 StringSourceFile; |
18 | 18 |
19 import 'compiler_test_case.dart'; | 19 import 'compiler_test_case.dart'; |
20 | 20 |
21 void nolog(_) {} | 21 void nolog(_) {} |
22 | 22 |
23 Script newScriptFrom(LibraryElement library, String newSource) { | 23 Script newScriptFrom(LibraryElement library, String newSource) { |
24 Script script = library.entryCompilationUnit.script; | 24 Script script = library.entryCompilationUnit.script; |
25 return script.copyWithFile( | 25 return script.copyWithFile( |
26 new StringSourceFile(script.file.filename, newSource)); | 26 new StringSourceFile.fromUri(script.file.uri, newSource)); |
27 } | 27 } |
28 | 28 |
29 class LibraryUpdaterTestCase extends CompilerTestCase { | 29 class LibraryUpdaterTestCase extends CompilerTestCase { |
30 final String newSource; | 30 final String newSource; |
31 | 31 |
32 final bool expectedCanReuse; | 32 final bool expectedCanReuse; |
33 | 33 |
34 final List<String> expectedUpdates; | 34 final List<String> expectedUpdates; |
35 | 35 |
36 LibraryUpdaterTestCase( | 36 LibraryUpdaterTestCase( |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 new LibraryUpdaterTestCase( | 131 new LibraryUpdaterTestCase( |
132 before: 'main() => null;', | 132 before: 'main() => null;', |
133 after: 'main() {}', | 133 after: 'main() {}', |
134 canReuse: true, | 134 canReuse: true, |
135 updates: ['main']), | 135 updates: ['main']), |
136 | 136 |
137 // TODO(ahe): When supporting class members, test abstract methods. | 137 // TODO(ahe): When supporting class members, test abstract methods. |
138 ] | 138 ] |
139 ); | 139 ); |
140 } | 140 } |
OLD | NEW |