| Index: packages/analyzer/test/src/summary/prelinker_test.dart
|
| diff --git a/packages/analyzer/test/src/summary/prelinker_test.dart b/packages/analyzer/test/src/summary/prelinker_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bfed9f2b6c7bc6743c98ad23f51918ab1281fdd7
|
| --- /dev/null
|
| +++ b/packages/analyzer/test/src/summary/prelinker_test.dart
|
| @@ -0,0 +1,56 @@
|
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +library analyzer.test.src.summary.prelinker_test;
|
| +
|
| +import 'package:analyzer/src/generated/utilities_dart.dart';
|
| +import 'package:analyzer/src/summary/idl.dart';
|
| +import 'package:analyzer/src/summary/prelink.dart';
|
| +import 'package:test_reflective_loader/test_reflective_loader.dart';
|
| +import 'package:unittest/unittest.dart';
|
| +
|
| +import 'summarize_ast_test.dart';
|
| +import 'summary_common.dart';
|
| +
|
| +main() {
|
| + groupSep = ' | ';
|
| + defineReflectiveTests(PrelinkerTest);
|
| +}
|
| +
|
| +/**
|
| + * Override of [SummaryTest] which verifies the correctness of the prelinker by
|
| + * creating summaries from the element model, discarding their prelinked
|
| + * information, and then recreating it using the prelinker.
|
| + */
|
| +@reflectiveTest
|
| +class PrelinkerTest extends LinkedSummarizeAstTest {
|
| + @override
|
| + bool get skipFullyLinkedData => true;
|
| +
|
| + @override
|
| + bool get strongMode => false;
|
| +
|
| + @override
|
| + void serializeLibraryText(String text, {bool allowErrors: false}) {
|
| + super.serializeLibraryText(text, allowErrors: allowErrors);
|
| +
|
| + UnlinkedUnit getPart(String relativeUri) {
|
| + String absoluteUri =
|
| + resolveRelativeUri(linkerInputs.testDartUri, Uri.parse(relativeUri))
|
| + .toString();
|
| + return linkerInputs.getUnit(absoluteUri);
|
| + }
|
| +
|
| + UnlinkedPublicNamespace getImport(String relativeUri) {
|
| + return getPart(relativeUri)?.publicNamespace;
|
| + }
|
| +
|
| + linked = new LinkedLibrary.fromBuffer(prelink(
|
| + linkerInputs.unlinkedDefiningUnit,
|
| + getPart,
|
| + getImport,
|
| + (String declaredVariable) => null).toBuffer());
|
| + validateLinkedLibrary(linked);
|
| + }
|
| +}
|
|
|