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

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

Issue 2342893002: Issue 27044. Summarize configurations of imports and exports, AST based. (Closed)
Patch Set: No equality test means '== true'. Created 4 years, 3 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/lib/src/summary/summarize_ast.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 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); }');
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_ast.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698