View | Details | Raw Unified | Return to bug 270437 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (+83 lines)
Lines 20314-20318 Link Here
20314
}
20314
}
20315
20315
20316
20316
20317
/**
20318
 * An inner/member class should not be offered as completion suggestion.
20319
 * @throws JavaModelException
20320
 */
20321
public void test270437a() throws JavaModelException {
20322
	this.workingCopies = new ICompilationUnit[1];
20323
	this.workingCopies[0] = getWorkingCopy(
20324
			"/Completion/src/test/Test270437a.java",
20325
			"package test;" +
20326
			"public class Test270437a extends Test270437a. {\n" +
20327
			"	public class Inner {}\n" +
20328
			"}\n");
20329
			
20330
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
20331
	String str = this.workingCopies[0].getSource();
20332
	String completeBehind = "Test270437a.";
20333
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
20334
20335
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
20336
	
20337
	// In the absence of the fix, the results would be as follows, which is wrong:
20338
	//"Test270437a.Inner[TYPE_REF]{Inner, test, Ltest.Test270437a$Inner;, null, 39}",
20339
	assertResults(
20340
			"", //Empty!
20341
			requestor.getResults());
20342
}
20343
20344
/**
20345
 * An inner/member interface should not be offered as completion suggestion.
20346
 * @throws JavaModelException
20347
 */
20348
public void test270437b() throws JavaModelException {
20349
	this.workingCopies = new ICompilationUnit[1];
20350
	this.workingCopies[0] = getWorkingCopy(
20351
			"/Completion/src/test/Test270437b.java",
20352
			"package test;" +
20353
			"public class Test270437b implements Test270437b. {\n" +
20354
			"	public interface Inner {}\n" +
20355
			"}\n");
20356
			
20357
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
20358
	String str = this.workingCopies[0].getSource();
20359
	String completeBehind = "Test270437b.";
20360
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
20361
20362
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
20363
	
20364
	// In the absence of the fix, the results would be as follows, which is wrong:
20365
	//"Test270437b.Inner[TYPE_REF]{Inner, test, Ltest.Test270437b$Inner;, null, 39}",
20366
	assertResults(
20367
			"", //Empty!
20368
			requestor.getResults());
20369
}
20370
20371
/**
20372
 * An inner/member interface should not be offered as completion suggestion.
20373
 * @throws JavaModelException
20374
 */
20375
public void test270437c() throws JavaModelException {
20376
	this.workingCopies = new ICompilationUnit[1];
20377
	this.workingCopies[0] = getWorkingCopy(
20378
			"/Completion/src/test/Test270437c.java",
20379
			"package test;" +
20380
			"class X extends X.MyClass1. {\n" +
20381
		    "    public class MyClass1 {\n" +
20382
		    "            public class MyClass2 {\n" +
20383
		    "            }\n" +
20384
		    "    }\n" +
20385
			"}\n");
20386
			
20387
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
20388
	String str = this.workingCopies[0].getSource();
20389
	String completeBehind = "X.MyClass1.";
20390
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
20391
20392
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
20393
	
20394
	// In the absence of the fix, the results would be as follows, which is wrong:
20395
	//"X.MyClass1.MyClass2[TYPE_REF]{MyClass2, test, Ltest.X$MyClass1$MyClass2;, null, 39}",
20396
	assertResults(
20397
			"", //Empty!
20398
			requestor.getResults());
20399
}
20317
20400
20318
}
20401
}

Return to bug 270437