| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library analyzer.test.src.summary.prelinker_test; | 5 library analyzer.test.src.summary.prelinker_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/utilities_dart.dart'; | 7 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 8 import 'package:analyzer/src/summary/idl.dart'; | 8 import 'package:analyzer/src/summary/idl.dart'; |
| 9 import 'package:analyzer/src/summary/prelink.dart'; | 9 import 'package:analyzer/src/summary/prelink.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 12 | 12 |
| 13 import 'summarize_ast_test.dart'; | 13 import 'summarize_ast_test.dart'; |
| 14 import 'summary_common.dart'; | 14 import 'summary_common.dart'; |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 groupSep = ' | '; | 17 groupSep = ' | '; |
| 18 defineReflectiveTests(PrelinkerTest); | 18 defineReflectiveTests(PrelinkerTest); |
| 19 } | 19 } |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * Override of [SummaryTest] which verifies the correctness of the prelinker by | 22 * Override of [SummaryTest] which verifies the correctness of the prelinker by |
| 23 * creating summaries from the element model, discarding their prelinked | 23 * creating summaries from the element model, discarding their prelinked |
| 24 * information, and then recreating it using the prelinker. | 24 * information, and then recreating it using the prelinker. |
| 25 */ | 25 */ |
| 26 @reflectiveTest | 26 @reflectiveTest |
| 27 class PrelinkerTest extends LinkedSummarizeAstTest { | 27 class PrelinkerTest extends LinkedSummarizeAstTest { |
| 28 @override | 28 @override |
| 29 bool get expectAbsoluteUrisInDependencies => false; | |
| 30 | |
| 31 @override | |
| 32 bool get skipFullyLinkedData => true; | 29 bool get skipFullyLinkedData => true; |
| 33 | 30 |
| 34 @override | 31 @override |
| 35 bool get strongMode => false; | 32 bool get strongMode => false; |
| 36 | 33 |
| 37 @override | 34 @override |
| 38 void serializeLibraryText(String text, {bool allowErrors: false}) { | 35 void serializeLibraryText(String text, {bool allowErrors: false}) { |
| 39 super.serializeLibraryText(text, allowErrors: allowErrors); | 36 super.serializeLibraryText(text, allowErrors: allowErrors); |
| 40 | 37 |
| 41 UnlinkedUnit getPart(String relativeUri) { | 38 UnlinkedUnit getPart(String relativeUri) { |
| 42 String absoluteUri = | 39 String absoluteUri = |
| 43 resolveRelativeUri(linkerInputs.testDartUri, Uri.parse(relativeUri)) | 40 resolveRelativeUri(linkerInputs.testDartUri, Uri.parse(relativeUri)) |
| 44 .toString(); | 41 .toString(); |
| 45 return linkerInputs.getUnit(absoluteUri); | 42 return linkerInputs.getUnit(absoluteUri); |
| 46 } | 43 } |
| 47 | 44 |
| 48 UnlinkedPublicNamespace getImport(String relativeUri) { | 45 UnlinkedPublicNamespace getImport(String relativeUri) { |
| 49 return getPart(relativeUri)?.publicNamespace; | 46 return getPart(relativeUri)?.publicNamespace; |
| 50 } | 47 } |
| 51 | 48 |
| 52 linked = new LinkedLibrary.fromBuffer(prelink( | 49 linked = new LinkedLibrary.fromBuffer(prelink( |
| 53 linkerInputs.unlinkedDefiningUnit, | 50 linkerInputs.unlinkedDefiningUnit, |
| 54 getPart, | 51 getPart, |
| 55 getImport, | 52 getImport, |
| 56 (String declaredVariable) => null).toBuffer()); | 53 (String declaredVariable) => null).toBuffer()); |
| 57 validateLinkedLibrary(linked); | 54 validateLinkedLibrary(linked); |
| 58 } | 55 } |
| 59 } | 56 } |
| OLD | NEW |