Lines 20102-20105
Link Here
|
20102 |
requestor.getResults()); |
20102 |
requestor.getResults()); |
20103 |
} |
20103 |
} |
20104 |
|
20104 |
|
|
|
20105 |
public void test270436a() throws JavaModelException { |
20106 |
// This test is to ensure that an interface is not offered as a choice when expecting a class. |
20107 |
this.workingCopies = new ICompilationUnit[1]; |
20108 |
this.workingCopies[0] = getWorkingCopy( |
20109 |
"/Completion/src/test/Test270436a.java", |
20110 |
"package test;\n" + |
20111 |
"public final class TestClass {}\n" + |
20112 |
"interface TestInterface {}\n" + |
20113 |
"class Subclass extends test.Test {}\n"); |
20114 |
|
20115 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
20116 |
String str = this.workingCopies[0].getSource(); |
20117 |
String completeBehind = "test.Test"; |
20118 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20119 |
|
20120 |
// In the absence of the fix, it would have been: |
20121 |
// TestInterface[TYPE_REF]{TestInterface, test, Ltest.TestInterface;, null, 19} |
20122 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20123 |
assertResults( |
20124 |
"", |
20125 |
requestor.getResults()); |
20126 |
} |
20127 |
|
20128 |
public void test270436b() throws JavaModelException { |
20129 |
// This test is to ensure that itself is not offered as choice during completion. |
20130 |
this.workingCopies = new ICompilationUnit[1]; |
20131 |
this.workingCopies[0] = getWorkingCopy( |
20132 |
"/Completion/src/test/Test270436b.java", |
20133 |
"package test;\n" + |
20134 |
"public final class TestClass {}\n" + |
20135 |
"interface TestInterface {}\n" + |
20136 |
"class Subclass extends test.Sub {}\n"); |
20137 |
|
20138 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
20139 |
String str = this.workingCopies[0].getSource(); |
20140 |
String completeBehind = "test.Sub"; |
20141 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20142 |
|
20143 |
// In the absence of the fix, it would have been: |
20144 |
// Subclass[TYPE_REF]{Subclass, test, Ltest.Subclass;, null, 39} |
20145 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20146 |
assertResults( |
20147 |
"", |
20148 |
requestor.getResults()); |
20149 |
} |
20150 |
|
20151 |
public void test270436c() throws JavaModelException { |
20152 |
// This test is to ensure that a class is not offered as a choice when expecting an interface. |
20153 |
this.workingCopies = new ICompilationUnit[1]; |
20154 |
this.workingCopies[0] = getWorkingCopy( |
20155 |
"/Completion/src/test/Test270436c.java", |
20156 |
"package test;\n" + |
20157 |
"public final class TestClass {}\n" + |
20158 |
"interface TestInterface {}\n" + |
20159 |
"class Subclass {}\n" + |
20160 |
"interface Subinterface extends test."); |
20161 |
|
20162 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
20163 |
String str = this.workingCopies[0].getSource(); |
20164 |
String completeBehind = "test."; |
20165 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20166 |
|
20167 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20168 |
assertResults( |
20169 |
// In the absence of this fix, it will have these additional ones as well. |
20170 |
//"Subclass[TYPE_REF]{Subclass, test, Ltest.Subclass;, null, 19}\n" + |
20171 |
//"TestClass[TYPE_REF]{TestClass, test, Ltest.TestClass;, null, 19}\n" + |
20172 |
"TestInterface[TYPE_REF]{TestInterface, test, Ltest.TestInterface;, null, 39}", |
20173 |
requestor.getResults()); |
20174 |
} |
20175 |
|
20105 |
} |
20176 |
} |