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

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

Issue 2628303002: Fix for crash when part directive uri is has null value. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_common.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4a6ee92b3870bfec6d8132773f79642305d89fe8..3c363dfb287657e198a86206df638f8fbc7c6bda 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -6471,6 +6471,17 @@ class B extends A {}
expect(unlinkedExports[0].configurations, isEmpty);
}
+ test_export_uri_nullStringValue() {
+ String libraryText = r'''
+export "${'a'}.dart";
+''';
+ serializeLibraryText(libraryText);
+ var unlinkedExports = unlinkedUnits[0].publicNamespace.exports;
+ expect(unlinkedExports, hasLength(1));
+ expect(unlinkedExports[0].uri, '');
+ expect(unlinkedExports[0].configurations, isEmpty);
+ }
+
test_export_variable() {
addNamedSource('/a.dart', 'var v;');
serializeLibraryText('export "a.dart";');
@@ -8346,6 +8357,16 @@ class D extends p.C {} // Prevent "unused import" warning
expect(unlinkedUnits[0].imports[0].uri, 'dart:async');
}
+ test_import_uri_nullStringValue() {
+ String libraryText = r'''
+import "${'a'}.dart";
+''';
+ serializeLibraryText(libraryText);
+ // Second import is the implicit import of dart:core
+ expect(unlinkedUnits[0].imports, hasLength(2));
+ expect(unlinkedUnits[0].imports[0].uri, '');
+ }
+
test_inferred_function_type_parameter_type_with_unrelated_type_param() {
if (!strongMode || skipFullyLinkedData) {
return;
@@ -9475,6 +9496,20 @@ f(x) => 42;
expect(unlinkedUnits[0].parts[0].uriEnd, text.indexOf('; // <-part'));
}
+ test_part_declaration_invalidUri_nullStringValue() {
+ addNamedSource('/a.dart', 'part of my.lib;');
+ String text = r'''
+library my.lib;
+part "${'a'}.dart"; // <-part
+''';
+ serializeLibraryText(text);
+ expect(unlinkedUnits[0].publicNamespace.parts, hasLength(1));
+ expect(unlinkedUnits[0].publicNamespace.parts[0], '');
+ expect(unlinkedUnits[0].parts, hasLength(1));
+ expect(unlinkedUnits[0].parts[0].uriOffset, text.indexOf(r'"${'));
+ expect(unlinkedUnits[0].parts[0].uriEnd, text.indexOf('; // <-part'));
+ }
+
test_part_isPartOf() {
addNamedSource('/a.dart', 'part of foo; class C {}');
serializeLibraryText('library foo; part "a.dart";');
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_common.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698