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

Unified Diff: editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/completion/CompletionTests.java

Issue 172763003: Issue 16153. Auto-complete for import statements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Extract helper and use marker constant Created 6 years, 10 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
Index: editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/completion/CompletionTests.java
diff --git a/editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/completion/CompletionTests.java b/editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/completion/CompletionTests.java
index f91efa690d4a18a2eac4425bc5d774c4f2de0744..b3289978de48353ae4f1a71a00b3c6bf496d1dfb 100644
--- a/editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/completion/CompletionTests.java
+++ b/editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/completion/CompletionTests.java
@@ -18,6 +18,13 @@ package com.google.dart.engine.services.completion;
*/
public class CompletionTests extends CompletionTestCase {
+ /**
+ * Replaces "!" with the {@link CompletionProposal#CURSOR_MARKER}.
+ */
+ private static String importUri(String uri) {
messick 2014/02/20 19:00:39 This should be visible to CompletionLibraryTests.
scheglov 2014/02/20 19:20:13 Moved to CompletionTests.
+ return uri.replace('!', CompletionProposal.CURSOR_MARKER);
+ }
+
public void test_classMembers_inGetter() throws Exception {
test("class A { var fff; get z {ff!1}}", "1+fff");
}
@@ -1731,6 +1738,13 @@ public class CompletionTests extends CompletionTestCase {
test("topValue = 7; class Foo { mth() { if (t!1) {}}}", "1+topValue");
}
+ public void testCompletion_import() throws Exception {
+ test(src(//
+ "import '!1';"),
+ importUri("1+dart:!"),
+ importUri("1+package:!"));
+ }
+
public void testCompletion_import_dart() throws Exception {
test(
src(//
@@ -1744,6 +1758,26 @@ public class CompletionTests extends CompletionTestCase {
"1-dart:_collection.dev");
}
+ public void testCompletion_import_noSpace() throws Exception {
+ test(src(//
+ "import!1",
+ ""), importUri("1+ 'dart:!';"), importUri("1+ 'package:!';"));
+ }
+
+ public void testCompletion_import_noStringLiteral() throws Exception {
+ test(src(//
+ "import !1;"),
+ importUri("1+'dart:!'"),
+ importUri("1+'package:!'"));
+ }
+
+ public void testCompletion_import_noStringLiteral_noSemicolon() throws Exception {
+ test(src(//
+ "import !1"),
+ importUri("1+'dart:!';"),
+ importUri("1+'package:!';"));
+ }
+
public void testCompletion_incompleteClassMember() throws Exception {
test(src(//
"class A {",

Powered by Google App Engine
This is Rietveld 408576698