Lines 20102-20105
Link Here
|
20102 |
requestor.getResults()); |
20102 |
requestor.getResults()); |
20103 |
} |
20103 |
} |
20104 |
|
20104 |
|
|
|
20105 |
public void test276526a() throws JavaModelException { |
20106 |
// This test is to ensure that an existing super interface is not offered as a completion choice, |
20107 |
// when all of them are in the same compilation unit. |
20108 |
this.workingCopies = new ICompilationUnit[1]; |
20109 |
this.workingCopies[0] = getWorkingCopy( |
20110 |
"/Completion/src/test/Test276526a.java", |
20111 |
"package test;\n" + |
20112 |
"interface IFoo {}\n" + |
20113 |
"interface IBar {}\n" + |
20114 |
"class Foo implements IFoo, test. {}\n"); |
20115 |
|
20116 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
20117 |
String str = this.workingCopies[0].getSource(); |
20118 |
String completeBehind = "test."; |
20119 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20120 |
|
20121 |
// In the absence of the fix, it would have been: |
20122 |
// "IBar[TYPE_REF]{IBar, test, Ltest.IBar;, null, 39}\n" + |
20123 |
// "IFoo[TYPE_REF]{IFoo, test, Ltest.IFoo;, null, 39}" |
20124 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20125 |
assertResults( |
20126 |
"IBar[TYPE_REF]{IBar, test, Ltest.IBar;, null, 39}", |
20127 |
requestor.getResults()); |
20128 |
} |
20129 |
|
20130 |
public void test276526b() throws JavaModelException { |
20131 |
// This test is to ensure that an existing super interface is not offered as a completion choice, |
20132 |
// when they are in different compilation units. |
20133 |
this.workingCopies = new ICompilationUnit[3]; |
20134 |
this.workingCopies[0] = getWorkingCopy( |
20135 |
"/Completion/src/test/Test276526b1.java", |
20136 |
"package test;\n" + |
20137 |
"public class TestClazz implements Interface1, test. {}"); |
20138 |
|
20139 |
this.workingCopies[1] = getWorkingCopy( |
20140 |
"/Completion/src/test/Test276526b2.java", |
20141 |
"package test;\n" + |
20142 |
"public interface Interface1 {}"); |
20143 |
|
20144 |
this.workingCopies[2] = getWorkingCopy( |
20145 |
"/Completion/src/test/Test276526b3.java", |
20146 |
"package test;\n" + |
20147 |
"public interface Interface2 {}"); |
20148 |
|
20149 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
20150 |
String str = this.workingCopies[0].getSource(); |
20151 |
String completeBehind = "test."; |
20152 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20153 |
|
20154 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20155 |
assertResults( |
20156 |
// In the absence of the fix, it would also complete to Interface1: |
20157 |
//"Interface1[TYPE_REF]{Interface1, test, Ltest.Interface1;, null, 39}\n"+ |
20158 |
"Interface2[TYPE_REF]{Interface2, test, Ltest.Interface2;, null, 39}", |
20159 |
requestor.getResults()); |
20160 |
} |
20161 |
|
20105 |
} |
20162 |
} |