mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
add unit test for bugzilla 174809
This commit is contained in:
parent
c9ea66eaaf
commit
14737740c6
4 changed files with 156 additions and 0 deletions
|
@ -0,0 +1,7 @@
|
|||
#include "CompletionTestStart40.h"
|
||||
|
||||
int var;
|
||||
|
||||
x
|
||||
|
||||
// end
|
|
@ -0,0 +1,61 @@
|
|||
#define DEBUG 1
|
||||
enum {
|
||||
aFirstEnum,
|
||||
aSecondEnum,
|
||||
aThirdEnum
|
||||
};
|
||||
|
||||
enum {
|
||||
xFirstEnum,
|
||||
xSecondEnum,
|
||||
xThirdEnum
|
||||
};
|
||||
|
||||
int notAnonymous;
|
||||
enum notAnonymousEnum {};
|
||||
class notAnonymousClass {};
|
||||
|
||||
struct {
|
||||
int aStructField;
|
||||
};
|
||||
|
||||
struct {
|
||||
int xStructField;
|
||||
};
|
||||
|
||||
union {
|
||||
int aUnionMember1, aUnionMember2;
|
||||
};
|
||||
|
||||
class {
|
||||
public:
|
||||
int aField;
|
||||
float xAClassField;
|
||||
int aMethod();
|
||||
void xAClassMethod(int x);
|
||||
};
|
||||
|
||||
class {
|
||||
public:
|
||||
int anotherField;
|
||||
void anotherMethod();
|
||||
};
|
||||
|
||||
class {
|
||||
public:
|
||||
xOtherClass(char*);
|
||||
xOtherClass(int);
|
||||
int xOtherField;
|
||||
void xOtherMethod();
|
||||
void xOtherMethod(int);
|
||||
};
|
||||
|
||||
// namespace {
|
||||
// void aNamespaceFunction(){
|
||||
// }
|
||||
// };
|
||||
|
||||
// namespace {
|
||||
// void xNamespaceFunction(){
|
||||
// }
|
||||
// };
|
|
@ -0,0 +1,86 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Symbian Software Ltd.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Ferguson (Symbian) - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist2;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Test that anonymous types are not returned as possibilites
|
||||
*/
|
||||
public class CompletionTest_AnonymousTypes extends CompletionProposalsBaseTest{
|
||||
private final String fileName = "CompletionTestStart40.cpp";
|
||||
private final String fileFullPath ="resources/contentassist/" + fileName;
|
||||
private final String headerFileName = "CompletionTestStart40.h";
|
||||
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
|
||||
private final String expectedPrefix = "";
|
||||
private final String[] expectedResults = {"notAnonymousEnum", "notAnonymousClass"};
|
||||
|
||||
public CompletionTest_AnonymousTypes(String name) {
|
||||
super(name);
|
||||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=174809
|
||||
setExpectFailure(174809);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite= new TestSuite(CompletionTest_AnonymousTypes.class.getName());
|
||||
suite.addTest(new CompletionTest_AnonymousTypes("testCompletionProposals"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||
*/
|
||||
protected int getCompletionPosition() {
|
||||
return getBuffer().indexOf(" x ");
|
||||
}
|
||||
|
||||
/* (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;
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* Norbert Ploett - Initial implementation
|
||||
* Bryan Wilkinson (QNX)
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.tests.text.contentassist2;
|
||||
|
||||
|
@ -26,6 +27,7 @@ public class ContentAssist2TestSuite extends TestSuite {
|
|||
public ContentAssist2TestSuite() {
|
||||
super("Tests in package org.eclipse.cdt.ui.tests.text.contentassist2");
|
||||
|
||||
addTest(CompletionTest_AnonymousTypes.suite());
|
||||
addTest(CompletionTest_ArgumentType_Prefix.suite());
|
||||
addTest(CompletionTest_ArgumentType_Prefix2.suite());
|
||||
addTest(CompletionTest_ClassReference_NoPrefix.suite());
|
||||
|
|
Loading…
Add table
Reference in a new issue