| 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 FunctionUpdate by pretty printing the updated element before and | 5 // Test of FunctionUpdate by pretty printing the updated element before and |
| 6 // after. | 6 // after. |
| 7 library trydart.library_updater_test; | 7 library trydart.library_updater_test; |
| 8 | 8 |
| 9 import 'dart:convert' show | 9 import 'dart:convert' show |
| 10 UTF8; | 10 UTF8; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class ApplyUpdateTestCase extends LibraryUpdaterTestCase { | 25 class ApplyUpdateTestCase extends LibraryUpdaterTestCase { |
| 26 final String expectedUpdate; | 26 final String expectedUpdate; |
| 27 | 27 |
| 28 ApplyUpdateTestCase( | 28 ApplyUpdateTestCase( |
| 29 {String before, | 29 {String before, |
| 30 String after, | 30 String after, |
| 31 String update}) | 31 String update}) |
| 32 : this.expectedUpdate = update, | 32 : this.expectedUpdate = update, |
| 33 super(before: before, after: after, canReuse: true); | 33 super(before: before, after: after, canReuse: true); |
| 34 | 34 |
| 35 Future run() => mainApp.then((LibraryElement library) { | 35 Future run() => loadMainApp().then((LibraryElement library) { |
| 36 // Capture the current version of [before] before invoking the [updater]. | 36 // Capture the current version of [before] before invoking the [updater]. |
| 37 PartialFunctionElement before = library.localLookup(expectedUpdate); | 37 PartialFunctionElement before = library.localLookup(expectedUpdate); |
| 38 var beforeNode = before.parseNode(compiler); | 38 var beforeNode = before.parseNode(compiler); |
| 39 | 39 |
| 40 LibraryUpdater updater = | 40 LibraryUpdater updater = |
| 41 new LibraryUpdater(this.compiler, null, scriptUri, nolog, nolog); | 41 new LibraryUpdater(this.compiler, null, scriptUri, nolog, nolog); |
| 42 bool actualCanReuse = | 42 bool actualCanReuse = |
| 43 updater.canReuseLibrary(library, UTF8.encode(newSource)); | 43 updater.canReuseLibrary(library, UTF8.encode(newSource)); |
| 44 Expect.equals(expectedCanReuse, actualCanReuse); | 44 Expect.equals(expectedCanReuse, actualCanReuse); |
| 45 | 45 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 new ApplyUpdateTestCase( | 90 new ApplyUpdateTestCase( |
| 91 before: 'main(){}', | 91 before: 'main(){}', |
| 92 after: 'main()=>null;', | 92 after: 'main()=>null;', |
| 93 update: 'main'), | 93 update: 'main'), |
| 94 | 94 |
| 95 // TODO(ahe): When supporting class members, test abstract methods. | 95 // TODO(ahe): When supporting class members, test abstract methods. |
| 96 ] | 96 ] |
| 97 ); | 97 ); |
| 98 } | 98 } |
| OLD | NEW |