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 element diff. | 5 /// Test of element diff. |
6 library trydart.diff_test; | 6 library trydart.diff_test; |
7 | 7 |
8 import 'dart:async' show | 8 import 'dart:async' show |
9 Future; | 9 Future; |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 Future<List<Difference>> testDifference( | 73 Future<List<Difference>> testDifference( |
74 String beforeSource, | 74 String beforeSource, |
75 String afterSource) { | 75 String afterSource) { |
76 Uri scriptUri = customUri('main.dart'); | 76 Uri scriptUri = customUri('main.dart'); |
77 MockCompiler compiler = compilerFor(beforeSource, scriptUri); | 77 MockCompiler compiler = compilerFor(beforeSource, scriptUri); |
78 | 78 |
79 Future<LibraryElement> future = compiler.libraryLoader.loadLibrary(scriptUri); | 79 Future<LibraryElement> future = compiler.libraryLoader.loadLibrary(scriptUri); |
80 return future.then((LibraryElement library) { | 80 return future.then((LibraryElement library) { |
81 Script sourceScript = new Script( | 81 Script sourceScript = new Script( |
82 scriptUri, scriptUri, new StringSourceFile('$scriptUri', afterSource)); | 82 scriptUri, scriptUri, |
| 83 new StringSourceFile.fromUri(scriptUri, afterSource)); |
83 var dartPrivacyIsBroken = compiler.libraryLoader; | 84 var dartPrivacyIsBroken = compiler.libraryLoader; |
84 LibraryElement newLibrary = dartPrivacyIsBroken.createLibrarySync( | 85 LibraryElement newLibrary = dartPrivacyIsBroken.createLibrarySync( |
85 null, sourceScript, scriptUri); | 86 null, sourceScript, scriptUri); |
86 return computeDifference(library, newLibrary); | 87 return computeDifference(library, newLibrary); |
87 }); | 88 }); |
88 } | 89 } |
89 | 90 |
90 Future testData(Map data) { | 91 Future testData(Map data) { |
91 String beforeSource = data['beforeSource']; | 92 String beforeSource = data['beforeSource']; |
92 String afterSource = data['afterSource']; | 93 String afterSource = data['afterSource']; |
(...skipping 21 matching lines...) Expand all Loading... |
114 expectedBeforeName, elementNameOrNull(difference.before)); | 115 expectedBeforeName, elementNameOrNull(difference.before)); |
115 Expect.stringEquals(expectedAfterName, elementNameOrNull(difference.after)); | 116 Expect.stringEquals(expectedAfterName, elementNameOrNull(difference.after)); |
116 print(difference); | 117 print(difference); |
117 } | 118 } |
118 Expect.isFalse(iterator.moveNext()); | 119 Expect.isFalse(iterator.moveNext()); |
119 } | 120 } |
120 | 121 |
121 void main() { | 122 void main() { |
122 asyncTest(() => Future.forEach(TEST_DATA, testData)); | 123 asyncTest(() => Future.forEach(TEST_DATA, testData)); |
123 } | 124 } |
OLD | NEW |