Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 2235373003: Fix summary handling of unresolved imports, exports, and parts. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Simplify `allowMissingFiles` Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/summary/summary_common.dart
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index d5f2876096b223e4295a130517c2a6e2f00fd568..09af9481e30740b69e6de676715c8d157bd7bcb9 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -1309,6 +1309,35 @@ class E {}
expect(cls.interfaces, isEmpty);
}
+ test_unresolved_import() {
+ allowMissingFiles = true;
+ serializeLibraryText("import 'foo.dart';", allowErrors: true);
+ expect(unlinkedUnits[0].imports, hasLength(2));
+ expect(unlinkedUnits[0].imports[0].uri, 'foo.dart');
+ // Note: imports[1] is the implicit import of dart:core.
+ expect(unlinkedUnits[0].imports[1].isImplicit, true);
+ expect(linked.importDependencies, hasLength(2));
+ checkDependency(
+ linked.importDependencies[0], absUri('/foo.dart'), 'foo.dart');
+ }
+
+ test_unresolved_export() {
+ allowMissingFiles = true;
+ serializeLibraryText("export 'foo.dart';", allowErrors: true);
+ expect(unlinkedUnits[0].publicNamespace.exports, hasLength(1));
+ expect(unlinkedUnits[0].publicNamespace.exports[0].uri, 'foo.dart');
+ expect(linked.exportDependencies, hasLength(1));
+ checkDependency(
+ linked.exportDependencies[0], absUri('/foo.dart'), 'foo.dart');
+ }
+
+ test_unresolved_part() {
+ allowMissingFiles = true;
+ serializeLibraryText("part 'foo.dart';", allowErrors: true);
+ expect(unlinkedUnits[0].publicNamespace.parts, hasLength(1));
+ expect(unlinkedUnits[0].publicNamespace.parts[0], 'foo.dart');
+ }
+
test_class_no_mixins() {
UnlinkedClass cls = serializeClassText('class C {}');
expect(cls.mixins, isEmpty);
@@ -2702,8 +2731,11 @@ const int v = p.a.length;
test_constExpr_pushInt_max() {
UnlinkedVariable variable = serializeVariableText('const v = 0xFFFFFFFF;');
- _assertUnlinkedConst(variable.initializer.bodyExpr,
- operators: [UnlinkedConstOperation.pushInt,], ints: [0xFFFFFFFF]);
+ _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+ UnlinkedConstOperation.pushInt,
+ ], ints: [
+ 0xFFFFFFFF
+ ]);
}
test_constExpr_pushInt_negative() {
@@ -2726,15 +2758,26 @@ const int v = p.a.length;
test_constExpr_pushLongInt_min2() {
UnlinkedVariable variable = serializeVariableText('const v = 0x100000000;');
- _assertUnlinkedConst(variable.initializer.bodyExpr,
- operators: [UnlinkedConstOperation.pushLongInt], ints: [2, 1, 0,]);
+ _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+ UnlinkedConstOperation.pushLongInt
+ ], ints: [
+ 2,
+ 1,
+ 0,
+ ]);
}
test_constExpr_pushLongInt_min3() {
UnlinkedVariable variable =
serializeVariableText('const v = 0x10000000000000000;');
- _assertUnlinkedConst(variable.initializer.bodyExpr,
- operators: [UnlinkedConstOperation.pushLongInt], ints: [3, 1, 0, 0,]);
+ _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+ UnlinkedConstOperation.pushLongInt
+ ], ints: [
+ 3,
+ 1,
+ 0,
+ 0,
+ ]);
}
test_constExpr_pushNull() {
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | pkg/analyzer/tool/task_dependency_graph/tasks.dot » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698