summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2017-10-15 13:21:43 -0700
committerGeorge Fraser <george@fivetran.com>2017-10-15 13:21:43 -0700
commitb9b6856c4536065ca590803d8e38d40eba89592d (patch)
tree418fbbda91e5c1fa94fcbebfee72d71208a4471f /src/test
parent74c58217d6c153b6c778d06325fe21fb79997f93 (diff)
downloadjava-language-server-b9b6856c4536065ca590803d8e38d40eba89592d.zip
Fix duplicate class names
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/javacs/CompletionsTest.java11
-rw-r--r--src/test/test-project/workspace/src/org/javacs/example/AutocompleteOnce.java7
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/org/javacs/CompletionsTest.java b/src/test/java/org/javacs/CompletionsTest.java
index 90685f8..0bd6ffe 100644
--- a/src/test/java/org/javacs/CompletionsTest.java
+++ b/src/test/java/org/javacs/CompletionsTest.java
@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
import java.io.IOException;
import java.net.URLClassLoader;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.lsp4j.CompletionItem;
@@ -746,4 +747,14 @@ public class CompletionsTest extends CompletionsBase {
assertThat("suggests local variable", suggestions, hasItems("length"));
}
+
+ @Test
+ public void onlySuggestOnce() throws IOException {
+ String file = "/org/javacs/example/AutocompleteOnce.java";
+
+ Map<String, Integer> suggestions = insertCount(file, 5, 18);
+
+ assertThat("suggests Signatures", suggestions, hasKey("Signatures"));
+ assertThat("suggests Signatures only once", suggestions, hasEntry("Signatures", 1));
+ }
}
diff --git a/src/test/test-project/workspace/src/org/javacs/example/AutocompleteOnce.java b/src/test/test-project/workspace/src/org/javacs/example/AutocompleteOnce.java
new file mode 100644
index 0000000..6e2d053
--- /dev/null
+++ b/src/test/test-project/workspace/src/org/javacs/example/AutocompleteOnce.java
@@ -0,0 +1,7 @@
+package org.javacs.example;
+
+public class AutocompleteOnce {
+ public void test() {
+ Signature
+ }
+} \ No newline at end of file