1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Revised content assist tests. No tests are kept artificially green anymore.

This commit is contained in:
Norbert Pltt 2006-07-18 11:49:55 +00:00
parent dad0cb33cd
commit 3d8c2ca8f6
14 changed files with 66 additions and 16 deletions

View file

@ -28,10 +28,10 @@ public class CompletionFailedTest_MemberReference_Arrow_Prefix2 extends Complet
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "a";
private final String[] expectedResults = {
"aClass",
"aField : int",
"aMethod(void) int"
/* FIXME: Additional results which should not be found. Run with trace activated to reproduce:
Result: aClass
Result: author - author name
*/
};

View file

@ -65,7 +65,7 @@ public abstract class CompletionProposalsBaseTest extends TestCase{
}
/*
* Derived classes have to provide there abstract methods
* Derived classes have to provide these test parameters
*/
protected abstract String getFileName();
protected abstract String getFileFullPath();
@ -76,6 +76,13 @@ public abstract class CompletionProposalsBaseTest extends TestCase{
protected abstract String[] getExpectedResultsValues();
protected String getFunctionOrConstructorName() { return EMPTY_STRING; }
/**
* Override to relax checking of extra results
*/
protected boolean doCheckExtraResults() {
return true ;
}
protected void setUp() throws Exception {
monitor = new NullProgressMonitor();
@ -115,6 +122,10 @@ public abstract class CompletionProposalsBaseTest extends TestCase{
}
public void testCompletionProposals() throws Exception {
if (CTestPlugin.getDefault().isDebugging()) {
System.out.println("\n\n\n\n\nTesting "+this.getClass().getName());
}
// setup the translation unit, the buffer and the document
ITranslationUnit tu = (ITranslationUnit)CoreModel.getDefault().create(fCFile);
buffer = tu.getBuffer().getContents();
@ -171,6 +182,9 @@ public abstract class CompletionProposalsBaseTest extends TestCase{
}
}
assertTrue("Not enough results!", results.length >= expected.length);
if (doCheckExtraResults()) {
assertEquals("Extra results! Run with tracing to see details!", expected.length, results.length);
}
assertTrue("Some expected results were not found!", allFound);
}

View file

@ -33,7 +33,7 @@ public class CompletionTest_ArgumentType_Prefix extends CompletionProposalsBase
"anotherClass",
"aNamespace",
"anEnumeration",
// "AStruct" FIXME: Result removed. The DOM search is currently case sensitive
"AStruct"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool

View file

@ -33,7 +33,7 @@ public class CompletionTest_ArgumentType_Prefix2 extends CompletionProposalsBas
"anotherClass",
"aNamespace",
"anEnumeration",
// "AStruct" FIXME: Result removed. DOM search is currently case sensitive
"AStruct"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool

View file

@ -35,7 +35,7 @@ public class CompletionTest_ExceptionReference_Prefix extends CompletionProposa
"anotherClass",
"aNamespace",
"anEnumeration",
// "AStruct" FIXME: Result removed. DOM search is currently case sensitive
"AStruct"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool

View file

@ -32,7 +32,7 @@ public class CompletionTest_FieldType_Prefix extends CompletionProposalsBaseTes
"aThirdClass",
"aNamespace",
"anEnumeration",
// "AStruct", FIXME: result removed: Lookup is currently case sensitive. "aStruct" would work!
"AStruct"
/* FIXME: Additional results which should not be returned. Run with tracing enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool

View file

@ -30,8 +30,6 @@ public class CompletionTest_MemberReference_Dot_Prefix extends CompletionPropos
private final String[] expectedResults = {
"aField : int",
"aMethod(void) int",
"aClass" /* FIXME: aClass is currently returned as a result, but this is not syntactically correct.
Completion processing needs to be fixed, putting this here as a reminder. */
};
public CompletionTest_MemberReference_Dot_Prefix(String name) {

View file

@ -32,9 +32,7 @@ public class CompletionTest_NewTypeReference_Prefix extends CompletionProposals
private final String[] expectedResults = {
"aClass",
"anotherClass",
"aNamespace",
"anEnumeration",
// "AStruct" FIXME: Result removed. DOM search is currently case sensitive
"AStruct"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool

View file

@ -31,10 +31,20 @@ public class CompletionTest_ScopedReference_Prefix extends CompletionProposalsB
private final String[] expectedResults = {
"aNamespaceFunction(void) void"
};
/* FIXME: Addtional result which should not be there. Run with tracing to reproduce:
Result: author - author name
*/
/* (non-Javadoc)
* Relax result checking here because the "a" prefix finds the template for "author"
* @see org.eclipse.cdt.ui.tests.text.contentassist2.CompletionProposalsBaseTest#doCheckExtraResults()
*/
protected boolean doCheckExtraResults() {
return false ;
}
public CompletionTest_ScopedReference_Prefix(String name) {
super(name);
}

View file

@ -40,10 +40,20 @@ public class CompletionTest_SingleName_Method_Prefix extends CompletionProposa
"aFirstEnum",
"aSecondEnum",
"aThirdEnum",
// "AStruct", FIXME: result removed: Lookup is currently case sensitive. "aStruct" would work!
// "AMacro(x)" FIXME: result removed: Lookup is currently case sensitive. "aMacro" would work!
"AStruct",
"AMacro(x)"
};
/* (non-Javadoc)
* Relax result checking here because the "a" prefix also finds the template for "author"
* @see org.eclipse.cdt.ui.tests.text.contentassist2.CompletionProposalsBaseTest#doCheckExtraResults()
*/
protected boolean doCheckExtraResults() {
return false ;
}
public CompletionTest_SingleName_Method_Prefix(String name) {
super(name);
}

View file

@ -37,8 +37,7 @@ public class CompletionTest_SingleName_Prefix2 extends CompletionProposalsBaseT
"aFirstEnum",
"aSecondEnum",
"aThirdEnum",
// "AStruct", FIXME: Result removed. DOM search is currently casesensitive.
// "AMacro(x)" FIXME: Result removed. DOM search is currently casesensitive.
"AMacro(x)"
/* FIXME: Additional results which should not be there. Run with tracing to reproduce:
* Result: author - author name
*/

View file

@ -35,6 +35,16 @@ public class CompletionTest_TypeDef_NoPrefix extends CompletionProposalsBaseTes
"myType"
};
/* (non-Javadoc)
* Relax checking here because the "m" prefix also finds the templates for "main" and "mutable"
* @see org.eclipse.cdt.ui.tests.text.contentassist2.CompletionProposalsBaseTest#doCheckExtraResults()
*/
protected boolean doCheckExtraResults() {
return false ;
}
public CompletionTest_TypeDef_NoPrefix(String name) {
super(name);
}

View file

@ -35,6 +35,17 @@ public class CompletionTest_TypeDef_Prefix extends CompletionProposalsBaseTest{
"myType"
};
/* (non-Javadoc)
* Checking for prefix "m" finds also the template for "main" and "mutable".
* --> we relax extra results checking in this case.
* @see org.eclipse.cdt.ui.tests.text.contentassist2.CompletionProposalsBaseTest#doCheckExtraResults()
*/
protected boolean doCheckExtraResults() {
return false ;
}
public CompletionTest_TypeDef_Prefix(String name) {
super(name);
}

View file

@ -31,7 +31,7 @@ public class CompletionTest_VariableType_Prefix extends CompletionProposalsBase
"anotherClass",
"aNamespace",
"anEnumeration",
// "AStruct" FIXME: Result removed. The DOM search is currently case sensitive
"AStruct"
};
public CompletionTest_VariableType_Prefix(String name) {