Lines 37-43
Link Here
|
37 |
public class CompletionTests extends AbstractJavaModelCompletionTests { |
37 |
public class CompletionTests extends AbstractJavaModelCompletionTests { |
38 |
|
38 |
|
39 |
static { |
39 |
static { |
40 |
// TESTS_NAMES = new String[] { "testDeprecationCheck17"}; |
40 |
// TESTS_NAMES = new String[] { "testBug310427c"}; |
41 |
} |
41 |
} |
42 |
public static Test suite() { |
42 |
public static Test suite() { |
43 |
return buildModelTestSuite(CompletionTests.class); |
43 |
return buildModelTestSuite(CompletionTests.class); |
Lines 21346-21371
Link Here
|
21346 |
} |
21346 |
} |
21347 |
|
21347 |
|
21348 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310427 |
21348 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310427 |
21349 |
// To verify that we don't get proposals for the field in whose declaration |
21349 |
// To verify that we don't get proposals for fields that have not yet been declared |
21350 |
// content assist is being invoked |
21350 |
// inside a field declaration statement |
21351 |
public void testBug310427a() throws JavaModelException { |
21351 |
public void testBug310427a() throws JavaModelException { |
21352 |
this.workingCopies = new ICompilationUnit[1]; |
21352 |
this.workingCopies = new ICompilationUnit[1]; |
21353 |
this.workingCopies[0] = getWorkingCopy( |
21353 |
this.workingCopies[0] = getWorkingCopy( |
21354 |
"/Completion/src/test/Test.java", |
21354 |
"/Completion/src/test/Test.java", |
21355 |
"package test;"+ |
21355 |
"package test;"+ |
21356 |
"public class Test {\n" + |
21356 |
"public class Test {\n" + |
21357 |
" private int myField1;\n" + |
21357 |
" int myVar1 = 1;\n" + |
21358 |
" private int myField2 = myFiel;\n" + |
21358 |
" int myVar2 = 1;\n" + |
|
|
21359 |
" int myVar3 = myVar;\n" + |
21360 |
" int myVar4 = 1;\n" + |
21361 |
" int myVar5 = 1;\n" + |
21362 |
" }\n" + |
21359 |
"}\n"); |
21363 |
"}\n"); |
21360 |
|
21364 |
|
21361 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); |
21365 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); |
21362 |
String str = this.workingCopies[0].getSource(); |
21366 |
String str = this.workingCopies[0].getSource(); |
21363 |
String completeBehind = "private int myField2 = myFiel"; |
21367 |
String completeBehind = "int myVar3 = myVar"; |
21364 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
21368 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
21365 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
21369 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
21366 |
|
21370 |
|
21367 |
assertResults( |
21371 |
assertResults( |
21368 |
"myField1[FIELD_REF]{myField1, Ltest.Test;, I, myField1, null, 57}", |
21372 |
"myVar1[FIELD_REF]{myVar1, Ltest.Test;, I, myVar1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}\n" + |
|
|
21373 |
"myVar2[FIELD_REF]{myVar2, Ltest.Test;, I, myVar2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}", |
21369 |
requestor.getResults()); |
21374 |
requestor.getResults()); |
21370 |
} |
21375 |
} |
21371 |
|
21376 |
|