diff options
author | Jay Arthanareeswaran | 2018-05-16 12:55:02 +0000 |
---|---|---|
committer | Vikas Chandra | 2018-05-16 12:55:02 +0000 |
commit | 3c1f931a101c94ed32e7720f0f054e09d5c7a877 (patch) | |
tree | 2c4420d3d0482fe3f08e24eb1a8f0636debd1684 | |
parent | 3099b8ee06532838b4698e588ccade22df81c3c3 (diff) | |
download | eclipse.jdt.core-3c1f931a101c94ed32e7720f0f054e09d5c7a877.tar.gz eclipse.jdt.core-3c1f931a101c94ed32e7720f0f054e09d5c7a877.tar.xz eclipse.jdt.core-3c1f931a101c94ed32e7720f0f054e09d5c7a877.zip |
Test cases for Bug 533740 - Keyword super/this is proposed in casesS4_8_0_RC1I20180520-2000I20180520-0800I20180519-1500I20180519-0800I20180518-2000I20180516-2000
where it is not allowed
Change-Id: I69c8ae76f2dfc7c02db3e45d8f477bc195ef4ea1
Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com >
-rw-r--r-- | org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java index 055a80256e..384e6af8f7 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java @@ -25792,4 +25792,96 @@ public void testBug528938() throws JavaModelException { "zzz[FIELD_REF]{zzz, LCompletionAfterCase1;, I, zzz, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_FINAL) + "}", requestor.getResults()); } +public void testBug533740a() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/Foo.java", + "interface X extends Y {\n" + + " public default void foo() {\n" + + " X.t\n" + + " }\n" + + "}\n" + + "interface Y {\n" + + " public default void bar() {}\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + requestor.allowAllRequiredProposals(); + String str = this.workingCopies[0].getSource(); + String completeBehind = "X.t"; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( + "this[KEYWORD]{this, null, null, this, null, 51}", + requestor.getResults()); +} +public void testBug533740b() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/Foo.java", + "interface X extends Y {\n" + + " public default void foo() {\n" + + " X.s\n" + + " }\n" + + "}\n" + + "interface Y {\n" + + " public default void bar() {}\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + requestor.allowAllRequiredProposals(); + String str = this.workingCopies[0].getSource(); + String completeBehind = "X.s"; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( + "", + requestor.getResults()); +} +public void testBug533740c() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/Foo.java", + "interface X extends Y {\n" + + " public default void foo() {\n" + + " Y.t\n" + + " }\n" + + "}\n" + + "interface Y {\n" + + " public default void bar() {}\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + requestor.allowAllRequiredProposals(); + String str = this.workingCopies[0].getSource(); + String completeBehind = "Y.t"; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( + "", + requestor.getResults()); +} +public void testBug533740d() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/Foo.java", + "interface X extends Y {\n" + + " public default void foo() {\n" + + " Y.s\n" + + " }\n" + + "}\n" + + "interface Y {\n" + + " public default void bar() {}\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + requestor.allowAllRequiredProposals(); + String str = this.workingCopies[0].getSource(); + String completeBehind = "Y.s"; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + assertResults( + "super[KEYWORD]{super, null, null, super, null, 51}", + requestor.getResults()); +} } |