summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2018-06-24 10:20:00 -0700
committerGeorge Fraser <george@fivetran.com>2018-06-24 10:20:00 -0700
commitbefec64ce85e15c5450e486e7ce045c6825b9296 (patch)
tree48384cff077ee9a31f014ee2554b8d5e261d76d5 /src/test
parent004b14fde1580abf7e40bb7f72fb65dfa793fbcd (diff)
downloadjava-language-server-befec64ce85e15c5450e486e7ce045c6825b9296.zip
Test completion in middle of method
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/javacs/JavaCompilerServiceTest.java16
-rw-r--r--src/test/resources/CompleteInMiddle.java17
2 files changed, 33 insertions, 0 deletions
diff --git a/src/test/java/org/javacs/JavaCompilerServiceTest.java b/src/test/java/org/javacs/JavaCompilerServiceTest.java
index 3a8c344..39989b0 100644
--- a/src/test/java/org/javacs/JavaCompilerServiceTest.java
+++ b/src/test/java/org/javacs/JavaCompilerServiceTest.java
@@ -106,6 +106,22 @@ public class JavaCompilerServiceTest {
}
@Test
+ public void identifiersInMiddle() {
+ List<Element> found =
+ compiler.scopeMembers(URI.create("/CompleteInMiddle.java"), contents("/CompleteInMiddle.java"), 13, 21);
+ List<String> names = elementNames(found);
+ assertThat(names, hasItem("completeLocal"));
+ assertThat(names, hasItem("completeParam"));
+ assertThat(names, hasItem("super"));
+ assertThat(names, hasItem("this"));
+ assertThat(names, hasItem("completeOtherMethod"));
+ assertThat(names, hasItem("completeInnerField"));
+ assertThat(names, hasItem("completeOuterField"));
+ assertThat(names, hasItem("completeOuterStatic"));
+ assertThat(names, hasItem("CompleteInMiddle"));
+ }
+
+ @Test
public void completeIdentifiers() {
List<Completion> found =
compiler.completions(
diff --git a/src/test/resources/CompleteInMiddle.java b/src/test/resources/CompleteInMiddle.java
new file mode 100644
index 0000000..981e71e
--- /dev/null
+++ b/src/test/resources/CompleteInMiddle.java
@@ -0,0 +1,17 @@
+class CompleteInMiddle {
+ static int completeOuterStatic;
+ int completeOuterField;
+
+ class CompleteInnerClass {
+ int completeInnerField;
+
+ void completeOtherMethod() {
+ }
+
+ void test(int completeParam) {
+ int completeLocal = 1;
+ complete
+ int localAfter = 2;
+ }
+ }
+} \ No newline at end of file