Lines 19627-19630
Link Here
|
19627 |
COMPLETION_PROJECT.setOptions(options); |
19627 |
COMPLETION_PROJECT.setOptions(options); |
19628 |
} |
19628 |
} |
19629 |
} |
19629 |
} |
|
|
19630 |
|
19631 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block |
19632 |
// All the tests with the prefix test269493 are designed to offer coverage for all the changes that went |
19633 |
// into this fix. |
19634 |
public void test269493() throws JavaModelException { |
19635 |
this.workingCopies = new ICompilationUnit[1]; |
19636 |
this.workingCopies[0] = getWorkingCopy( |
19637 |
"/Completion/src/test/Test269493.java", |
19638 |
"package test;" + |
19639 |
"public class Test269493 {\n" + |
19640 |
" void foo() {\n" + |
19641 |
" for (int i = 0; i < 10; i++)\n" + |
19642 |
" ass\n" + |
19643 |
" }\n" + |
19644 |
"}\n" + |
19645 |
"}\n"); |
19646 |
|
19647 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19648 |
String str = this.workingCopies[0].getSource(); |
19649 |
String completeBehind = "ass"; |
19650 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19651 |
|
19652 |
// Save current compliance settings |
19653 |
Map options = COMPLETION_PROJECT.getOptions(true); |
19654 |
Object savedOptionCompliance = options.get(CompilerOptions.OPTION_Compliance); |
19655 |
|
19656 |
try { |
19657 |
options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4); |
19658 |
COMPLETION_PROJECT.setOptions(options); |
19659 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19660 |
assertResults( |
19661 |
"assert[KEYWORD]{assert, null, null, assert, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", |
19662 |
requestor.getResults()); |
19663 |
} finally { |
19664 |
// Restore compliance settings. |
19665 |
options.put(CompilerOptions.OPTION_Compliance, savedOptionCompliance); |
19666 |
COMPLETION_PROJECT.setOptions(options); |
19667 |
} |
19668 |
} |
19669 |
|
19670 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block |
19671 |
public void test269493b() throws JavaModelException { |
19672 |
this.workingCopies = new ICompilationUnit[1]; |
19673 |
this.workingCopies[0] = getWorkingCopy( |
19674 |
"/Completion/src/test/Test269493.java", |
19675 |
"package test;" + |
19676 |
"public class Test269493 {\n" + |
19677 |
" void foo() {\n" + |
19678 |
" for (int i = 0; i < 10; i++)\n" + |
19679 |
" ret\n" + |
19680 |
" }\n" + |
19681 |
"}\n" + |
19682 |
"}\n"); |
19683 |
|
19684 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19685 |
String str = this.workingCopies[0].getSource(); |
19686 |
String completeBehind = "ret"; |
19687 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19688 |
|
19689 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19690 |
assertResults( |
19691 |
"return[KEYWORD]{return, null, null, return, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", |
19692 |
requestor.getResults()); |
19693 |
} |
19694 |
|
19695 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block |
19696 |
public void test269493c() throws JavaModelException { |
19697 |
this.workingCopies = new ICompilationUnit[1]; |
19698 |
this.workingCopies[0] = getWorkingCopy( |
19699 |
"/Completion/src/test/Test269493.java", |
19700 |
"package test;" + |
19701 |
"public class Test269493 {\n" + |
19702 |
" void foo() {\n" + |
19703 |
" for (int i = 0; i < 10; i++)\n" + |
19704 |
" bre\n" + |
19705 |
" }\n" + |
19706 |
"}\n" + |
19707 |
"}\n"); |
19708 |
|
19709 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19710 |
String str = this.workingCopies[0].getSource(); |
19711 |
String completeBehind = "bre"; |
19712 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19713 |
|
19714 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19715 |
assertResults( |
19716 |
"break[KEYWORD]{break, null, null, break, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", |
19717 |
requestor.getResults()); |
19718 |
} |
19719 |
|
19720 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block |
19721 |
public void test269493d() throws JavaModelException { |
19722 |
this.workingCopies = new ICompilationUnit[1]; |
19723 |
this.workingCopies[0] = getWorkingCopy( |
19724 |
"/Completion/src/test/Test269493.java", |
19725 |
"package test;" + |
19726 |
"public class Test269493 {\n" + |
19727 |
" void foo() {\n" + |
19728 |
" for (int i = 0; i < 10; i++)\n" + |
19729 |
" cont\n" + |
19730 |
" }\n" + |
19731 |
"}\n" + |
19732 |
"}\n"); |
19733 |
|
19734 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19735 |
String str = this.workingCopies[0].getSource(); |
19736 |
String completeBehind = "cont"; |
19737 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19738 |
|
19739 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19740 |
assertResults( |
19741 |
"continue[KEYWORD]{continue, null, null, continue, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", |
19742 |
requestor.getResults()); |
19743 |
} |
19744 |
|
19745 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block |
19746 |
public void test269493e() throws JavaModelException { |
19747 |
this.workingCopies = new ICompilationUnit[1]; |
19748 |
this.workingCopies[0] = getWorkingCopy( |
19749 |
"/Completion/src/test/Test269493.java", |
19750 |
"package test;" + |
19751 |
"public class Test269493 {\n" + |
19752 |
" int foo(int p) {\n" + |
19753 |
" if (p == 0)\n" + |
19754 |
" return 0;\n" + |
19755 |
" else\n" + |
19756 |
" ret\n" + |
19757 |
" }\n" + |
19758 |
"}\n" + |
19759 |
"}\n"); |
19760 |
|
19761 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19762 |
String str = this.workingCopies[0].getSource(); |
19763 |
String completeBehind = "ret"; |
19764 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19765 |
|
19766 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19767 |
assertResults( |
19768 |
"return[KEYWORD]{return, null, null, return, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", |
19769 |
requestor.getResults()); |
19770 |
} |
19771 |
|
19772 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block |
19773 |
public void test269493f() throws JavaModelException { |
19774 |
this.workingCopies = new ICompilationUnit[1]; |
19775 |
this.workingCopies[0] = getWorkingCopy( |
19776 |
"/Completion/src/test/Test269493.java", |
19777 |
"package test;" + |
19778 |
"public class Test269493 {\n" + |
19779 |
" int foo(int p) {\n" + |
19780 |
" if (p == 0)\n" + |
19781 |
" return 0;\n" + |
19782 |
" els\n" + |
19783 |
" }\n" + |
19784 |
"}\n" + |
19785 |
"}\n"); |
19786 |
|
19787 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19788 |
String str = this.workingCopies[0].getSource(); |
19789 |
String completeBehind = "els"; |
19790 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19791 |
|
19792 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19793 |
assertResults( |
19794 |
"else[KEYWORD]{else, null, null, else, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", |
19795 |
requestor.getResults()); |
19796 |
} |
19797 |
|
19798 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block |
19799 |
public void test269493g() throws JavaModelException { |
19800 |
this.workingCopies = new ICompilationUnit[1]; |
19801 |
this.workingCopies[0] = getWorkingCopy( |
19802 |
"/Completion/src/test/Test269493.java", |
19803 |
"package test;" + |
19804 |
"public class Test269493 {\n" + |
19805 |
" int foo(int p) {\n" + |
19806 |
" els\n" + |
19807 |
" }\n" + |
19808 |
"}\n" + |
19809 |
"}\n"); |
19810 |
|
19811 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19812 |
String str = this.workingCopies[0].getSource(); |
19813 |
String completeBehind = "els"; |
19814 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19815 |
|
19816 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19817 |
assertResults( |
19818 |
"", |
19819 |
requestor.getResults()); |
19820 |
} |
19821 |
|
19822 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block |
19823 |
public void test269493h() throws JavaModelException { |
19824 |
this.workingCopies = new ICompilationUnit[1]; |
19825 |
this.workingCopies[0] = getWorkingCopy( |
19826 |
"/Completion/src/test/Test269493.java", |
19827 |
"package test;" + |
19828 |
"public class Test269493 {\n" + |
19829 |
" int foo(int p) {\n" + |
19830 |
" if (p == 0)\n" + |
19831 |
" return 0;\n" + |
19832 |
" else\n" + |
19833 |
" els\n" + |
19834 |
" }\n" + |
19835 |
"}\n" + |
19836 |
"}\n"); |
19837 |
|
19838 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19839 |
String str = this.workingCopies[0].getSource(); |
19840 |
String completeBehind = "els"; |
19841 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19842 |
|
19843 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19844 |
assertResults( |
19845 |
"", |
19846 |
requestor.getResults()); |
19847 |
} |
19848 |
|
19849 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=269493: Keywords are not proposed in a for loop without block |
19850 |
public void test269493i() throws JavaModelException { |
19851 |
this.workingCopies = new ICompilationUnit[1]; |
19852 |
this.workingCopies[0] = getWorkingCopy( |
19853 |
"/Completion/src/test/Test269493.java", |
19854 |
"package test;" + |
19855 |
"public class Test269493 {\n" + |
19856 |
" int foo(int p) {\n" + |
19857 |
" if (p == 0) {\n" + |
19858 |
" return 0;\n" + |
19859 |
" }\n" + |
19860 |
" else\n" + |
19861 |
" els\n" + |
19862 |
" }\n" + |
19863 |
"}\n" + |
19864 |
"}\n"); |
19865 |
|
19866 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19867 |
String str = this.workingCopies[0].getSource(); |
19868 |
String completeBehind = "els"; |
19869 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19870 |
|
19871 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19872 |
assertResults( |
19873 |
"", |
19874 |
requestor.getResults()); |
19875 |
} |
19876 |
|
19630 |
} |
19877 |
} |