diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/javacs/JavaCompilerServiceTest.java | 16 | ||||
-rw-r--r-- | src/test/resources/CompleteInMiddle.java | 17 |
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 |