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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 2343103003: ImportElement/ExportElement 'uri' should be the selected URI. (Closed)
Patch Set: 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
« pkg/analyzer/lib/dart/ast/ast.dart ('K') | « pkg/analyzer/lib/src/task/dart.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/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index b2205cce07dc1012a423e3a16dd28bda6071232f..f9ebf8c5442bb539f425ece56112993b6d3048fd 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -356,6 +356,52 @@ library libB;
}
}
+ test_perform_configurations_export() {
+ context.declaredVariables.define('dart.library.io', 'true');
+ context.declaredVariables.define('dart.library.html', 'true');
+ newSource('/foo.dart', '');
+ var foo_io = newSource('/foo_io.dart', '');
+ newSource('/foo_html.dart', '');
+ var testSource = newSource(
+ '/test.dart',
+ r'''
+export 'foo.dart'
+ if (dart.library.io) 'foo_io.dart'
+ if (dart.library.html) 'foo_html.dart';
+''');
+ // Perform the task.
+ computeResult(testSource, LIBRARY_ELEMENT2,
+ matcher: isBuildDirectiveElementsTask);
+ LibraryElement testLibrary = outputs[LIBRARY_ELEMENT2];
+ // Validate the export element.
+ ExportElement export = testLibrary.exports[0];
+ expect(export.exportedLibrary.source, foo_io);
+ expect(export.uri, 'foo_io.dart');
+ }
+
+ test_perform_configurations_import() {
+ context.declaredVariables.define('dart.library.io', 'true');
+ context.declaredVariables.define('dart.library.html', 'true');
+ newSource('/foo.dart', '');
+ var foo_io = newSource('/foo_io.dart', '');
+ newSource('/foo_html.dart', '');
+ var testSource = newSource(
+ '/test.dart',
+ r'''
+import 'foo.dart'
+ if (dart.library.io) 'foo_io.dart'
+ if (dart.library.html) 'foo_html.dart';
+''');
+ // Perform the task.
+ computeResult(testSource, LIBRARY_ELEMENT2,
+ matcher: isBuildDirectiveElementsTask);
+ LibraryElement testLibrary = outputs[LIBRARY_ELEMENT2];
+ // Validate the import element.
+ ImportElement import = testLibrary.imports[0];
+ expect(import.importedLibrary.source, foo_io);
+ expect(import.uri, 'foo_io.dart');
+ }
+
test_perform_dartCoreContext() {
List<Source> sources = newSources({'/libA.dart': ''});
Source source = sources[0];
« pkg/analyzer/lib/dart/ast/ast.dart ('K') | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698