Lines 821-826
Link Here
|
821 |
|
821 |
|
822 |
assertTrue("acceptContext() method isn't call", rc.acceptContext); |
822 |
assertTrue("acceptContext() method isn't call", rc.acceptContext); |
823 |
} |
823 |
} |
|
|
824 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140123 |
825 |
public void testEvaluationContextCompletion2() throws JavaModelException { |
826 |
class EvaluationContextCompletionRequestor extends CompletionRequestor { |
827 |
public boolean acceptContext; |
828 |
public boolean beginReporting; |
829 |
public boolean endReporting; |
830 |
|
831 |
public void acceptContext(CompletionContext context) { |
832 |
this.acceptContext = context != null; |
833 |
} |
834 |
public void accept(CompletionProposal proposal) { |
835 |
// Do nothing |
836 |
} |
837 |
|
838 |
public void beginReporting() { |
839 |
this.beginReporting = true; |
840 |
super.beginReporting(); |
841 |
} |
842 |
|
843 |
public void endReporting() { |
844 |
this.endReporting = true; |
845 |
super.endReporting(); |
846 |
} |
847 |
} |
848 |
String start = ""; |
849 |
IJavaProject javaProject = getJavaProject("Completion"); |
850 |
IEvaluationContext context = javaProject.newEvaluationContext(); |
851 |
EvaluationContextCompletionRequestor rc = new EvaluationContextCompletionRequestor(); |
852 |
context.codeComplete(start, start.length(), rc); |
853 |
|
854 |
assertTrue("acceptContext() method isn't call", rc.acceptContext); |
855 |
assertTrue("beginReporting() method isn't call", rc.beginReporting); |
856 |
assertTrue("endReporting() method isn't call", rc.endReporting); |
857 |
} |
858 |
|
859 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140123 |
860 |
public void testEvaluationContextCompletion3() throws JavaModelException { |
861 |
this.workingCopies = new ICompilationUnit[1]; |
862 |
this.workingCopies[0] = getWorkingCopy( |
863 |
"/Completion/src/test/TestEvaluationContextCompletion3.java", |
864 |
"package test;"+ |
865 |
"public class TestEvaluationContextCompletion3 {\n"+ |
866 |
"}"); |
867 |
|
868 |
String start = "TestEvaluationContextCompletion3"; |
869 |
IJavaProject javaProject = getJavaProject("Completion"); |
870 |
IEvaluationContext context = javaProject.newEvaluationContext(); |
871 |
|
872 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, false); |
873 |
context.codeComplete(start, start.length(), requestor, this.wcOwner); |
874 |
|
875 |
int startOffset = 0; |
876 |
int endOffset = start.length(); |
877 |
|
878 |
assertResults( |
879 |
"completion offset="+endOffset+"\n"+ |
880 |
"completion range=["+startOffset+", "+(endOffset-1)+"]\n"+ |
881 |
"completion token=\"TestEvaluationContextCompletion3\"\n"+ |
882 |
"completion token kind=TOKEN_KIND_NAME\n"+ |
883 |
"expectedTypesSignatures=null\n"+ |
884 |
"expectedTypesKeys=null", |
885 |
requestor.getContext()); |
886 |
|
887 |
assertResults( |
888 |
"TestEvaluationContextCompletion3[TYPE_REF]{test.TestEvaluationContextCompletion3, test, Ltest.TestEvaluationContextCompletion3;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", |
889 |
requestor.getResults()); |
890 |
} |
891 |
|
892 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140123 |
893 |
public void testEvaluationContextCompletion4() throws JavaModelException { |
894 |
this.workingCopies = new ICompilationUnit[1]; |
895 |
this.workingCopies[0] = getWorkingCopy( |
896 |
"/Completion/src/test/TestEvaluationContextCompletion4.java", |
897 |
"package test;"+ |
898 |
"public class TestEvaluationContextCompletion4 {\n"+ |
899 |
"}"); |
900 |
|
901 |
String start = "TestEvaluationContextCompletion4"; |
902 |
IJavaProject javaProject = getJavaProject("Completion"); |
903 |
IEvaluationContext context = javaProject.newEvaluationContext(); |
904 |
|
905 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, false); |
906 |
requestor.setIgnored(CompletionProposal.TYPE_REF, true); |
907 |
context.codeComplete(start, start.length(), requestor, this.wcOwner); |
908 |
|
909 |
int startOffset = 0; |
910 |
int endOffset = start.length(); |
911 |
|
912 |
assertResults( |
913 |
"completion offset="+endOffset+"\n"+ |
914 |
"completion range=["+startOffset+", "+(endOffset-1)+"]\n"+ |
915 |
"completion token=\"TestEvaluationContextCompletion4\"\n"+ |
916 |
"completion token kind=TOKEN_KIND_NAME\n"+ |
917 |
"expectedTypesSignatures=null\n"+ |
918 |
"expectedTypesKeys=null", |
919 |
requestor.getContext()); |
920 |
|
921 |
assertResults( |
922 |
"", |
923 |
requestor.getResults()); |
924 |
} |
824 |
|
925 |
|
825 |
/** |
926 |
/** |
826 |
* Ensures that completion is not case sensitive |
927 |
* Ensures that completion is not case sensitive |