mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Content Assist Work: More JUnit tests
This commit is contained in:
parent
878174520e
commit
9c870f74bf
39 changed files with 593 additions and 75 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-01-29 Hoda Amer
|
||||
Put CompletionKind.FUNCTION_REFERENCE back.
|
||||
|
||||
2004-01-28 John Camelon
|
||||
Fixed Bug 50821 - Freezes when opening / saving .c file
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public interface IASTCompletionNode {
|
|||
// any place where exclusively a preprocessor macro name would be expected
|
||||
public static final CompletionKind MACRO_REFERENCE = new CompletionKind( 10 );
|
||||
|
||||
// any place where constructor arguments are expected
|
||||
// any place where constructor parameters are expected
|
||||
public static final CompletionKind CONSTRUCTOR_REFERENCE = new CompletionKind( 12 );
|
||||
|
||||
// any place where exclusively a keyword is expected
|
||||
|
@ -67,6 +67,9 @@ public interface IASTCompletionNode {
|
|||
// any place where a type or variable name is expected to be introduced
|
||||
public static final CompletionKind USER_SPECIFIED_NAME = new CompletionKind( 15 );
|
||||
|
||||
// any place where function parameters are expected
|
||||
public static final CompletionKind FUNCTION_REFERENCE = new CompletionKind( 16 );
|
||||
|
||||
// after a new expression
|
||||
public static final CompletionKind NEW_TYPE_REFERENCE = new CompletionKind( 17 );
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2004-01-29 Hoda Amer
|
||||
Added two more tests, namely Function_Reference and Constructor_Reference.
|
||||
Moved tests starts resources all to one directory.
|
||||
|
||||
2004-01-28 John Camelon
|
||||
Updated and renamed CompletionFailedTest_NewTypeReference_NoPrefix_Bug50711 to CompletionTest_NewTypeReference_NoPrefix, moving it to the success tests directory.
|
||||
Updated and renamed CompletionFailedTest_NewTypeReference_Prefix_Bug50711 to CompletionTest_NewTypeReference_Prefix, moving it to the success tests directory.
|
||||
|
|
|
@ -52,8 +52,11 @@ public:
|
|||
|
||||
class xOtherClass {
|
||||
public:
|
||||
xOtherClass(char*);
|
||||
xOtherClass(int);
|
||||
int xOtherField;
|
||||
void xOtherMethod();
|
||||
void xOtherMethod(int);
|
||||
};
|
||||
|
||||
namespace aNamespace {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
using namespace
|
|
@ -0,0 +1,3 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
using namespace a
|
|
@ -0,0 +1,6 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
int anotherClass::anotherMethod(){
|
||||
xOtherClass c;
|
||||
c.xOtherMethod (
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
#include "CompletionTestStart.h"
|
||||
|
||||
int anotherClass::anotherMethod(){
|
||||
xOtherClass* a = new xOtherClass (
|
||||
}
|
|
@ -56,20 +56,24 @@ public class AutomatedSuite extends TestSuite {
|
|||
addTest(CompletionTest_MemberReference_Arrow_Prefix.suite());
|
||||
addTest(CompletionTest_MemberReference_Arrow_Prefix2.suite());
|
||||
addTest(CompletionTest_MemberReference_Arrow_NoPrefix.suite());
|
||||
addTest(CompletionTest_NamespaceRef_Prefix.suite());
|
||||
addTest(CompletionTest_NamespaceRef_NoPrefix.suite());
|
||||
addTest(CompletionTest_TypeRef_NoPrefix.suite());
|
||||
addTest(CompletionTest_TypeRef_Prefix.suite());
|
||||
addTest(CompletionTest_ClassReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ClassReference_Prefix.suite());
|
||||
addTest(CompletionTest_NewTypeReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_NewTypeReference_Prefix.suite());
|
||||
addTest(CompletionTest_ExceptionReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ExceptionReference_Prefix.suite());
|
||||
|
||||
// Failed Tests
|
||||
addTest(CompletionFailedTest_ScopedReference_NoPrefix_Bug50152.suite());
|
||||
addTest(CompletionFailedTest_ScopedReference_Prefix_Bug50152.suite());
|
||||
addTest(CompletionTest_TypeRef_NoPrefix.suite());
|
||||
addTest(CompletionTest_TypeRef_Prefix.suite());
|
||||
addTest(CompletionFailedTest_MacroRef_NoPrefix_Bug50487.suite());
|
||||
addTest(CompletionFailedTest_MacroRef_Prefix_Bug50487.suite());
|
||||
addTest(CompletionTest_ClassReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ClassReference_Prefix.suite());
|
||||
addTest(CompletionTest_ExceptionReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_ExceptionReference_Prefix.suite());
|
||||
addTest(CompletionTest_NewTypeReference_NoPrefix.suite());
|
||||
addTest(CompletionTest_NewTypeReference_Prefix.suite());
|
||||
addTest(CompletionFailedTest_FunctionReference_Bug50807.suite());
|
||||
addTest(CompletionFailedTest_ConstructorReference_Bug50808.suite());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
|||
*/
|
||||
public class CompletionTest_ClassReference_NoPrefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart8.h";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart21.h";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
|
@ -33,10 +33,10 @@ public class CompletionTest_ClassReference_NoPrefix extends CompletionProposals
|
|||
private final CompletionKind expectedKind = CompletionKind.CLASS_REFERENCE;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {
|
||||
// Should be
|
||||
// "aClass",
|
||||
// "anotherClass",
|
||||
// "xOtherClass"
|
||||
"aClass",
|
||||
"anotherClass",
|
||||
"ClassA",
|
||||
"xOtherClass"
|
||||
};
|
||||
|
||||
public CompletionTest_ClassReference_NoPrefix(String name) {
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
|||
*/
|
||||
public class CompletionTest_ClassReference_Prefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart7.h";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart20.h";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
|
@ -33,9 +33,8 @@ public class CompletionTest_ClassReference_Prefix extends CompletionProposalsBa
|
|||
private final CompletionKind expectedKind = CompletionKind.CLASS_REFERENCE;
|
||||
private final String expectedPrefix = "a";
|
||||
private final String[] expectedResults = {
|
||||
// Should be
|
||||
// "aClass",
|
||||
// "anotherClass"
|
||||
"aClass",
|
||||
"anotherClass"
|
||||
};
|
||||
|
||||
public CompletionTest_ClassReference_Prefix(String name) {
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
|||
*/
|
||||
public class CompletionTest_ExceptionReference_NoPrefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart10.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart23.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTMethod";
|
||||
|
@ -34,14 +34,7 @@ public class CompletionTest_ExceptionReference_NoPrefix extends CompletionPropo
|
|||
private final CompletionKind expectedKind = CompletionKind.EXCEPTION_REFERENCE;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {
|
||||
//TODO Hoda is this right? namespaces should not be allowed, unless you mean for qualified type
|
||||
// Should be
|
||||
// "aClass",
|
||||
// "anotherClass",
|
||||
// "aNamespace",
|
||||
// "anEnumeration",
|
||||
// "AStruct",
|
||||
// "..."
|
||||
"..."
|
||||
};
|
||||
|
||||
public CompletionTest_ExceptionReference_NoPrefix(String name) {
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
|||
*/
|
||||
public class CompletionTest_ExceptionReference_Prefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart9.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart22.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTMethod";
|
||||
|
@ -34,13 +34,11 @@ public class CompletionTest_ExceptionReference_Prefix extends CompletionProposa
|
|||
private final CompletionKind expectedKind = CompletionKind.EXCEPTION_REFERENCE;
|
||||
private final String expectedPrefix = "a";
|
||||
private final String[] expectedResults = {
|
||||
//TODO Hoda please validate/verify this list
|
||||
// Should be
|
||||
// "aClass",
|
||||
// "anotherClass",
|
||||
// "aNamespace",
|
||||
// "anEnumeration",
|
||||
// "AStruct"
|
||||
"aClass",
|
||||
"anotherClass",
|
||||
"aNamespace",
|
||||
"anEnumeration",
|
||||
"AStruct"
|
||||
};
|
||||
|
||||
public CompletionTest_ExceptionReference_Prefix(String name) {
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Namespace_Reference, with no prefix
|
||||
* Bug#50471 : Wrong completion kind after the "using" keyword
|
||||
*
|
||||
*/
|
||||
public class CompletionTest_NamespaceRef_NoPrefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionTestStart32.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.NAMESPACE_REFERENCE;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {
|
||||
"aNamespace",
|
||||
"xNamespace"
|
||||
};
|
||||
|
||||
public CompletionTest_NamespaceRef_NoPrefix(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionTest_NamespaceRef_NoPrefix.class.getName());
|
||||
suite.addTest(new CompletionTest_NamespaceRef_NoPrefix("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf("namespace ") + 10;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Namespace_Reference, with prefix
|
||||
* Bug#50471 : Wrong completion kind after the "using" keyword
|
||||
*
|
||||
*/
|
||||
public class CompletionTest_NamespaceRef_Prefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionTestStart33.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
private final String expectedContextName = "null";
|
||||
private final CompletionKind expectedKind = CompletionKind.NAMESPACE_REFERENCE;
|
||||
private final String expectedPrefix = "a";
|
||||
private final String[] expectedResults = {
|
||||
"aNamespace"
|
||||
};
|
||||
|
||||
public CompletionTest_NamespaceRef_Prefix(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionTest_NamespaceRef_Prefix.class.getName());
|
||||
suite.addTest(new CompletionTest_NamespaceRef_Prefix("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf("namespace a ") + 11;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -24,8 +24,8 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
|||
*/
|
||||
public class CompletionTest_NewTypeReference_NoPrefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart12.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart29.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTMethod";
|
||||
|
@ -33,9 +33,6 @@ public class CompletionTest_NewTypeReference_NoPrefix extends CompletionProposa
|
|||
private final CompletionKind expectedKind = CompletionKind.NEW_TYPE_REFERENCE;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {
|
||||
//TODO - Hoda please look into why these results do not resolve
|
||||
// should be
|
||||
// "aClass"
|
||||
};
|
||||
|
||||
public CompletionTest_NewTypeReference_NoPrefix(String name) {
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
|||
*/
|
||||
public class CompletionTest_NewTypeReference_Prefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart11.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart28.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTMethod";
|
||||
|
@ -33,12 +33,11 @@ public class CompletionTest_NewTypeReference_Prefix extends CompletionProposals
|
|||
private final CompletionKind expectedKind = CompletionKind.NEW_TYPE_REFERENCE;
|
||||
private final String expectedPrefix = "a";
|
||||
private final String[] expectedResults = {
|
||||
// Should be
|
||||
// "aClass",
|
||||
// "anotherClass",
|
||||
// "aNamespace",
|
||||
// "anEnumeration",
|
||||
// "AStruct"
|
||||
"aClass",
|
||||
"anotherClass",
|
||||
"aNamespace",
|
||||
"anEnumeration",
|
||||
"AStruct"
|
||||
};
|
||||
|
||||
public CompletionTest_NewTypeReference_Prefix(String name) {
|
||||
|
|
|
@ -17,14 +17,14 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
|||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Namespace_Reference, with no prefix
|
||||
* Testing Type_Reference, with no prefix
|
||||
* Bug#50471 : Wrong completion kind after the "using" keyword
|
||||
*
|
||||
*/
|
||||
public class CompletionTest_TypeRef_NoPrefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart3.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart24.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
|
|
|
@ -18,14 +18,14 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
|||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Namespace_Reference, with prefix
|
||||
* Testing Type_Reference, with prefix
|
||||
* Bug#50471 : Wrong completion kind after the "using" keyword
|
||||
*
|
||||
*/
|
||||
public class CompletionTest_TypeRef_Prefix extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart4.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart25.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Constructor_Reference
|
||||
* Bug#
|
||||
*
|
||||
*/
|
||||
public class CompletionFailedTest_ConstructorReference_Bug50808 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionTestStart35.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTMethod";
|
||||
private final String expectedContextName = "null"; // should be "ASTClassSpecifier"
|
||||
private final CompletionKind expectedKind = CompletionKind.NEW_TYPE_REFERENCE; // should be CompletionKind.CONSTRUCTOR_REFERENCE;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {
|
||||
// should be
|
||||
// "xOtherClass(char*)",
|
||||
// "xOtherClass(int)"
|
||||
};
|
||||
|
||||
public CompletionFailedTest_ConstructorReference_Bug50808(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionFailedTest_ConstructorReference_Bug50808.class.getName());
|
||||
suite.addTest(new CompletionFailedTest_ConstructorReference_Bug50808("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf("( ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 Rational Software Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist.failedtests;
|
||||
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
|
||||
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
||||
|
||||
/**
|
||||
* @author hamer
|
||||
*
|
||||
* Testing Function_Reference
|
||||
* Bug#
|
||||
*
|
||||
*/
|
||||
public class CompletionFailedTest_FunctionReference_Bug50807 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionTestStart34.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTMethod";
|
||||
private final String expectedContextName = "null"; // either the context or the prefix should be meaningful "ASTMethod"
|
||||
private final CompletionKind expectedKind = CompletionKind.SINGLE_NAME_REFERENCE; // should be CompletionKind.FUNCTION_REFERENCE;
|
||||
private final String expectedPrefix = ""; // should be "xAClassMethod"
|
||||
private final String[] expectedResults = {
|
||||
// should be
|
||||
// "xOtherMethod() void",
|
||||
// "xOtherMethod(int) void"
|
||||
};
|
||||
|
||||
public CompletionFailedTest_FunctionReference_Bug50807(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionFailedTest_FunctionReference_Bug50807.class.getName());
|
||||
suite.addTest(new CompletionFailedTest_FunctionReference_Bug50807("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf("( ") + 2;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
|
||||
*/
|
||||
protected String getExpectedScopeClassName() {
|
||||
return expectedScopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
|
||||
*/
|
||||
protected String getExpectedContextClassName() {
|
||||
return expectedContextName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
|
||||
*/
|
||||
protected CompletionKind getExpectedKind() {
|
||||
return expectedKind;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||
*/
|
||||
protected String getExpectedPrefix() {
|
||||
return expectedPrefix;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||
*/
|
||||
protected String[] getExpectedResultsValues() {
|
||||
return expectedResults;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||
*/
|
||||
protected String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||
*/
|
||||
protected String getFileFullPath() {
|
||||
return fileFullPath;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||
*/
|
||||
protected String getHeaderFileFullPath() {
|
||||
return headerFileFullPath;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||
*/
|
||||
protected String getHeaderFileName() {
|
||||
return headerFileName;
|
||||
}
|
||||
|
||||
}
|
|
@ -24,8 +24,8 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
|||
*/
|
||||
public class CompletionFailedTest_MacroRef_NoPrefix_Bug50487 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart5.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart26.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
|||
*/
|
||||
public class CompletionFailedTest_MacroRef_Prefix_Bug50487 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart6.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart27.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTCompilationUnit";
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
|||
*/
|
||||
public class CompletionFailedTest_ScopedReference_NoPrefix_Bug50152 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart1.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart30.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTMethod";
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsBaseTest;
|
|||
*/
|
||||
public class CompletionFailedTest_ScopedReference_Prefix_Bug50152 extends CompletionProposalsBaseTest{
|
||||
|
||||
private final String fileName = "CompletionFailedTestStart2.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/failedtests/" + fileName;
|
||||
private final String fileName = "CompletionTestStart31.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedScopeName = "ASTMethod";
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2004-01-29 Hoda Amer
|
||||
Added handling for CompletionOnFunctionReference()
|
||||
|
||||
2004-01-28 Alain Magloire
|
||||
|
||||
First draft of the OpenType by Chris Wiebe.
|
||||
|
|
|
@ -464,7 +464,6 @@ public class CompletionEngine implements RelevanceConstants {
|
|||
kinds[1] = IASTNode.LookupKind.METHODS;
|
||||
result = lookup (searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
|
||||
addToCompletions (result);
|
||||
|
||||
}
|
||||
|
||||
// private void completionOnStatementStart( IASTCompletionNode completionNode )
|
||||
|
@ -629,13 +628,13 @@ public class CompletionEngine implements RelevanceConstants {
|
|||
IASTScope searchNode = completionNode.getCompletionScope();
|
||||
// look for the specific type being newed and the scope
|
||||
IASTNode context = completionNode.getCompletionContext();
|
||||
if ((context != null) && (context instanceof IASTClassSpecifier)){
|
||||
IASTClassSpecifier classContext = (IASTClassSpecifier) context;
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||
kinds[0] = IASTNode.LookupKind.STRUCTURES;
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, null);
|
||||
addToCompletions(result);
|
||||
}
|
||||
// if ((context != null) && (context instanceof IASTClassSpecifier)){
|
||||
// IASTClassSpecifier classContext = (IASTClassSpecifier) context;
|
||||
// IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||
// kinds[0] = IASTNode.LookupKind.STRUCTURES;
|
||||
// ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, null);
|
||||
// addToCompletions(result);
|
||||
// }
|
||||
// basic completion on all types
|
||||
completionOnTypeReference(completionNode);
|
||||
}
|
||||
|
@ -649,6 +648,16 @@ public class CompletionEngine implements RelevanceConstants {
|
|||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, null);
|
||||
addToCompletions(result);
|
||||
}
|
||||
private void completionOnFunctionReference(IASTCompletionNode completionNode){
|
||||
// 1. Get the search scope node
|
||||
IASTScope searchNode = completionNode.getCompletionScope();
|
||||
// only lookup this function
|
||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[2];
|
||||
kinds[0] = IASTNode.LookupKind.FUNCTIONS;
|
||||
kinds[1] = IASTNode.LookupKind.METHODS;
|
||||
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, null);
|
||||
addToCompletions(result);
|
||||
}
|
||||
private void completionOnKeyword(IASTCompletionNode completionNode){
|
||||
// lookup every type of keywords
|
||||
// 1. basic types keword list
|
||||
|
@ -739,6 +748,10 @@ public class CompletionEngine implements RelevanceConstants {
|
|||
// completionOnNewTypeReference
|
||||
completionOnNewTypeReference(completionNode);
|
||||
}
|
||||
else if(kind == CompletionKind.FUNCTION_REFERENCE){
|
||||
// completionOnFunctionReference
|
||||
completionOnFunctionReference(completionNode);
|
||||
}
|
||||
else if(kind == CompletionKind.CONSTRUCTOR_REFERENCE){
|
||||
// completionOnConstructorReference
|
||||
completionOnConstructorReference(completionNode);
|
||||
|
|
Loading…
Add table
Reference in a new issue