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

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

Issue 3003233002: flag to limit file and package URI completion suggestions (Closed)
Patch Set: Created 3 years, 4 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/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 7fae478401453e5d5b3b4906e63f3d9fc348781b..008498450d63596f2993d26fa8eefe10aa9e7027 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
@@ -76,6 +76,20 @@ class UriContributorTest extends DartCompletionContributorTest {
csKind: CompletionSuggestionKind.IMPORT);
}
+ test_export_package2_off() async {
+ try {
+ UriContributor.suggestFilePaths = false;
+ addPackageSource('foo', 'foo.dart', 'library foo;');
+ addPackageSource('foo', 'baz/too.dart', 'library too;');
+ addPackageSource('bar', 'bar.dart', 'library bar;');
+ addTestSource('export "package:foo/baz/^" import');
+ await computeSuggestions();
+ assertNotSuggested('package:foo/baz/too.dart');
+ } finally {
+ UriContributor.suggestFilePaths = true;
+ }
+ }
+
test_import() async {
addTestSource('import "^"');
await computeSuggestions();
@@ -163,6 +177,28 @@ class UriContributorTest extends DartCompletionContributorTest {
assertNotSuggested('../blat.dart');
}
+ test_import_file2_off() async {
+ try {
+ UriContributor.suggestFilePaths = false;
+ testFile = '/proj/completion.dart';
+ addSource('/proj/other.dart', 'library other;');
+ addSource('/proj/foo/bar.dart', 'library bar;');
+ addSource('/blat.dart', 'library blat;');
+ addTestSource('import "..^" import');
+ await computeSuggestions();
+ expect(replacementOffset, completionOffset - 2);
+ expect(replacementLength, 2);
+ assertNotSuggested('completion.dart');
+ assertNotSuggested('other.dart');
+ assertNotSuggested('foo');
+ assertNotSuggested('foo/');
+ assertNotSuggested('foo/bar.dart');
+ assertNotSuggested('../blat.dart');
+ } finally {
+ UriContributor.suggestFilePaths = true;
+ }
+ }
+
test_import_file_child() async {
testFile = '/proj/completion.dart';
addSource('/proj/other.dart', 'library other;');
@@ -265,6 +301,20 @@ class UriContributorTest extends DartCompletionContributorTest {
csKind: CompletionSuggestionKind.IMPORT);
}
+ test_import_package2_off() async {
+ try {
+ UriContributor.suggestFilePaths = false;
+ addPackageSource('foo', 'foo.dart', 'library foo;');
+ addPackageSource('foo', 'baz/too.dart', 'library too;');
+ addPackageSource('bar', 'bar.dart', 'library bar;');
+ addTestSource('import "package:foo/baz/^" import');
+ await computeSuggestions();
+ assertNotSuggested('package:foo/baz/too.dart');
+ } finally {
+ UriContributor.suggestFilePaths = true;
+ }
+ }
+
test_import_package2_raw() async {
addPackageSource('foo', 'foo.dart', 'library foo;');
addPackageSource('foo', 'baz/too.dart', 'library too;');
« 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