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

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

Issue 1117963002: add import file uri suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 8 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/test/services/completion/completion_test_util.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/import_uri_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/import_uri_contributor_test.dart b/pkg/analysis_server/test/services/completion/import_uri_contributor_test.dart
index 9e8aefa1f664bccc6288d56d5e4ae0177d433edc..89c13307217fe7caba0b07e43fcfdd25f79fa69e 100644
--- a/pkg/analysis_server/test/services/completion/import_uri_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/import_uri_contributor_test.dart
@@ -18,22 +18,6 @@ main() {
@reflectiveTest
class ImportUriContributorTest extends AbstractCompletionTest {
- fail_import_file() {
- 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');
- computeFast();
- expect(request.replacementOffset, completionOffset);
- expect(request.replacementLength, 0);
- assertNotSuggested('completion.dart');
- assertSuggest('other.dart', csKind: CompletionSuggestionKind.IMPORT);
- assertSuggest('foo', csKind: CompletionSuggestionKind.IMPORT);
- assertNotSuggested('foo/bar.dart');
- assertNotSuggested('../blat.dart');
- }
-
@override
void setUpContributor() {
contributor = new ImportUriContributor();
@@ -72,6 +56,70 @@ class ImportUriContributorTest extends AbstractCompletionTest {
assertSuggest('dart:math', csKind: CompletionSuggestionKind.IMPORT);
}
+ test_import_file() {
+ 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');
+ computeFast();
+ expect(request.replacementOffset, completionOffset);
+ expect(request.replacementLength, 0);
+ assertNotSuggested('completion.dart');
+ assertSuggest('other.dart', csKind: CompletionSuggestionKind.IMPORT);
+ assertSuggest('foo/', csKind: CompletionSuggestionKind.IMPORT);
+ assertNotSuggested('foo/bar.dart');
+ assertNotSuggested('../blat.dart');
+ }
+
+ test_import_file2() {
+ 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');
+ computeFast();
+ expect(request.replacementOffset, completionOffset - 2);
+ expect(request.replacementLength, 2);
+ assertNotSuggested('completion.dart');
+ assertSuggest('other.dart', csKind: CompletionSuggestionKind.IMPORT);
+ assertSuggest('foo/', csKind: CompletionSuggestionKind.IMPORT);
+ assertNotSuggested('foo/bar.dart');
+ assertNotSuggested('../blat.dart');
+ }
+
+ test_import_file_child() {
+ testFile = '/proj/completion.dart';
+ addSource('/proj/other.dart', 'library other;');
+ addSource('/proj/foo/bar.dart', 'library bar;');
+ addSource('/blat.dart', 'library blat;');
+ addTestSource('import "foo/^" import');
+ computeFast();
+ expect(request.replacementOffset, completionOffset - 4);
+ expect(request.replacementLength, 4);
+ assertNotSuggested('completion.dart');
+ assertNotSuggested('other.dart');
+ assertNotSuggested('foo');
+ assertSuggest('foo/bar.dart', csKind: CompletionSuggestionKind.IMPORT);
+ assertNotSuggested('../blat.dart');
+ }
+
+ test_import_file_parent() {
+ 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');
+ computeFast();
+ expect(request.replacementOffset, completionOffset - 3);
+ expect(request.replacementLength, 3);
+ assertNotSuggested('completion.dart');
+ assertNotSuggested('other.dart');
+ assertNotSuggested('foo');
+ assertNotSuggested('foo/bar.dart');
+ assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT);
+ }
+
test_import_package() {
addPackageSource('foo', 'foo.dart', 'library foo;');
addPackageSource('foo', 'baz/too.dart', 'library too;');
« no previous file with comments | « pkg/analysis_server/test/services/completion/completion_test_util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698