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

Unified Diff: pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart

Issue 1509373005: do not suggest import uri reaching out of lib (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years 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/analysis_server/lib/src/services/completion/dart/uri_contributor.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
index e6c2384096f24fcffd7332e167fadce48239ee8c..f12074436add766d8342c4adbecdb2b2c7efb045 100644
--- a/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
@@ -173,11 +173,32 @@ class UriContributorTest extends DartCompletionContributorTest {
assertNotSuggested('../blat.dart');
}
+ test_import_file_outside_lib() async {
+ testFile = '/proj/lib/completion.dart';
+ addSource('/proj/lib/other.dart', 'library other;');
+ addSource('/proj/lib/foo/bar.dart', 'library bar;');
+ addSource('/proj/blat.dart', 'library blat;');
+ addSource('/proj/bin/boo.dart', 'library boo;');
+ addTestSource('import "../^" import');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset - 3);
+ expect(replacementLength, 3);
+ assertNotSuggested('completion.dart');
+ assertNotSuggested('other.dart');
+ assertNotSuggested('foo');
+ assertNotSuggested('foo/');
+ assertNotSuggested('foo/bar.dart');
+ assertNotSuggested('../bin');
+ assertNotSuggested('../bin/');
+ assertNotSuggested('../blat.dart');
+ }
+
test_import_file_parent() async {
testFile = '/proj/completion.dart';
addSource('/proj/other.dart', 'library other;');
addSource('/proj/foo/bar.dart', 'library bar;');
addSource('/blat.dart', 'library blat;');
+ addSource('/proj2/boo.dart', 'library boo;');
addTestSource('import "../^" import');
await computeSuggestions();
expect(replacementOffset, completionOffset - 3);
@@ -188,6 +209,7 @@ class UriContributorTest extends DartCompletionContributorTest {
assertNotSuggested('foo/');
assertNotSuggested('foo/bar.dart');
assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT);
+ assertSuggest('../proj2/', csKind: CompletionSuggestionKind.IMPORT);
}
test_import_file_parent2() async {
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698