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 cde78ee72230c3a83295c447d1d7284982eaccc3..b108ff12a8ff617a7c8955bac8ea0717ef0dcd4a 100644 |
--- a/pkg/analyzer/test/src/summary/summary_common.dart |
+++ b/pkg/analyzer/test/src/summary/summary_common.dart |
@@ -6057,6 +6057,36 @@ f(MyFunction myFunction) {} |
ReferenceKind.classOrEnum); |
} |
+ test_export_configurations() { |
+ if (!checkAstDerivedData) { |
+ // Element model does not provide access to configurations. |
+ return; |
+ } |
+ addNamedSource('/foo.dart', 'bar() {}'); |
+ addNamedSource('/foo_io.dart', 'bar() {}'); |
+ addNamedSource('/foo_html.dart', 'bar() {}'); |
+ String libraryText = r''' |
+export 'foo.dart' |
+ if (dart.library.io) 'foo_io.dart' |
+ if (dart.flavor == 'html') 'foo_html.dart'; |
+'''; |
+ serializeLibraryText(libraryText); |
+ UnlinkedExportPublic exp = unlinkedUnits[0].publicNamespace.exports[0]; |
+ expect(exp.configurations, hasLength(2)); |
+ { |
+ UnlinkedConfiguration configuration = exp.configurations[0]; |
+ expect(configuration.name, 'dart.library.io'); |
+ expect(configuration.value, 'true'); |
+ expect(configuration.uri, 'foo_io.dart'); |
+ } |
+ { |
+ UnlinkedConfiguration configuration = exp.configurations[1]; |
+ expect(configuration.name, 'dart.flavor'); |
+ expect(configuration.value, 'html'); |
+ expect(configuration.uri, 'foo_html.dart'); |
+ } |
+ } |
+ |
test_export_dependency() { |
serializeLibraryText('export "dart:async";'); |
expect(unlinkedUnits[0].exports, hasLength(1)); |
@@ -6260,8 +6290,10 @@ f(MyFunction myFunction) {} |
String uriString = '"a.dart"'; |
String libraryText = 'export $uriString;'; |
serializeLibraryText(libraryText); |
- expect(unlinkedUnits[0].publicNamespace.exports, hasLength(1)); |
- expect(unlinkedUnits[0].publicNamespace.exports[0].uri, 'a.dart'); |
+ var unlinkedExports = unlinkedUnits[0].publicNamespace.exports; |
+ expect(unlinkedExports, hasLength(1)); |
+ expect(unlinkedExports[0].uri, 'a.dart'); |
+ expect(unlinkedExports[0].configurations, isEmpty); |
} |
test_export_variable() { |
@@ -7878,6 +7910,36 @@ get f => null;'''; |
expect(aDep, lessThan(bDep)); |
} |
+ test_import_configurations() { |
+ if (!checkAstDerivedData) { |
+ // Element model does not provide access to configurations. |
+ return; |
+ } |
+ addNamedSource('/foo.dart', 'bar() {}'); |
+ addNamedSource('/foo_io.dart', 'bar() {}'); |
+ addNamedSource('/foo_html.dart', 'bar() {}'); |
+ String libraryText = r''' |
+import 'foo.dart' |
+ if (dart.library.io) 'foo_io.dart' |
+ if (dart.flavor == 'html') 'foo_html.dart'; |
+'''; |
+ serializeLibraryText(libraryText); |
+ UnlinkedImport imp = unlinkedUnits[0].imports[0]; |
+ expect(imp.configurations, hasLength(2)); |
+ { |
+ UnlinkedConfiguration configuration = imp.configurations[0]; |
+ expect(configuration.name, 'dart.library.io'); |
+ expect(configuration.value, 'true'); |
+ expect(configuration.uri, 'foo_io.dart'); |
+ } |
+ { |
+ UnlinkedConfiguration configuration = imp.configurations[1]; |
+ expect(configuration.name, 'dart.flavor'); |
+ expect(configuration.value, 'html'); |
+ expect(configuration.uri, 'foo_html.dart'); |
+ } |
+ } |
+ |
test_import_deferred() { |
serializeLibraryText( |
'import "dart:async" deferred as a; main() { print(a.Future); }'); |