| 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. | 5 // Test of LibraryUpdater. |
| 6 library trydart.library_updater_test; | 6 library trydart.library_updater_test; |
| 7 | 7 |
| 8 import 'dart:convert' show | 8 import 'dart:convert' show |
| 9 UTF8; | 9 UTF8; |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 this.expectedUpdates = updates, | 33 this.expectedUpdates = updates, |
| 34 super(before); | 34 super(before); |
| 35 | 35 |
| 36 Future run() => mainApp.then((LibraryElement library) { | 36 Future run() => mainApp.then((LibraryElement library) { |
| 37 LibraryUpdater updater = | 37 LibraryUpdater updater = |
| 38 new LibraryUpdater(this.compiler, null, scriptUri, nolog, nolog); | 38 new LibraryUpdater(this.compiler, null, scriptUri, nolog, nolog); |
| 39 bool actualCanReuse = | 39 bool actualCanReuse = |
| 40 updater.canReuseLibrary(library, UTF8.encode(newSource)); | 40 updater.canReuseLibrary(library, UTF8.encode(newSource)); |
| 41 Expect.equals(expectedCanReuse, actualCanReuse); | 41 Expect.equals(expectedCanReuse, actualCanReuse); |
| 42 | 42 |
| 43 Expect.equals(expectedCanReuse, updater.hasPendingUpdates); | |
| 44 | |
| 45 Expect.setEquals( | 43 Expect.setEquals( |
| 46 expectedUpdates.toSet(), | 44 expectedUpdates.toSet(), |
| 47 updater.updates.map((Update update) => update.before.name).toSet()); | 45 updater.updates.map((Update update) => update.before.name).toSet()); |
| 48 }); | 46 }); |
| 49 | 47 |
| 50 String toString() => 'Before:\n$source\n\n\nAfter:\n$newSource'; | 48 String toString() => 'Before:\n$source\n\n\nAfter:\n$newSource'; |
| 51 } | 49 } |
| 52 | 50 |
| 53 void main() { | 51 void main() { |
| 54 runTests( | 52 runTests( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 new LibraryUpdaterTestCase( | 112 new LibraryUpdaterTestCase( |
| 115 before: 'main() => null;', | 113 before: 'main() => null;', |
| 116 after: 'main() {}', | 114 after: 'main() {}', |
| 117 canReuse: true, | 115 canReuse: true, |
| 118 updates: ['main']), | 116 updates: ['main']), |
| 119 | 117 |
| 120 // TODO(ahe): When supporting class members, test abstract methods. | 118 // TODO(ahe): When supporting class members, test abstract methods. |
| 121 ] | 119 ] |
| 122 ); | 120 ); |
| 123 } | 121 } |
| OLD | NEW |