mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
test tweaks
This commit is contained in:
parent
40ca0f5538
commit
0bf6b02659
3 changed files with 27 additions and 21 deletions
|
@ -21,13 +21,9 @@ import junit.framework.TestCase;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||
import org.eclipse.cdt.internal.ui.CHelpProviderManager;
|
||||
import org.eclipse.cdt.internal.ui.text.CHelpBookDescriptor;
|
||||
import org.eclipse.cdt.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.testplugin.FileManager;
|
||||
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -58,18 +54,6 @@ abstract public class BaseTestFramework extends TestCase {
|
|||
|
||||
project = cproject.getProject();
|
||||
project.setSessionProperty(IndexManager.activationKey, Boolean.FALSE );
|
||||
|
||||
//disable the help books so we don't get proposals we weren't expecting
|
||||
CHelpBookDescriptor helpBooks[];
|
||||
helpBooks = CHelpProviderManager.getDefault().getCHelpBookDescriptors(new ICHelpInvocationContext(){
|
||||
public IProject getProject(){return project;}
|
||||
public ITranslationUnit getTranslationUnit(){return null;}
|
||||
}
|
||||
);
|
||||
for( int i = 0; i < helpBooks.length; i++ ){
|
||||
if( helpBooks[i] != null )
|
||||
helpBooks[i].enable( false );
|
||||
}
|
||||
} catch ( CoreException e ) {
|
||||
/*boo*/
|
||||
}
|
||||
|
|
|
@ -99,8 +99,8 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
protected Set search( ICSearchPattern pattern, ICElement[] list ) {
|
||||
//leave default scope as workspace
|
||||
try {
|
||||
ICSearchScope scope = SearchEngine.createCSearchScope(list);
|
||||
searchEngine.search( workspace, pattern, scope, resultCollector, false );
|
||||
ICSearchScope searchScope = SearchEngine.createCSearchScope(list);
|
||||
searchEngine.search( workspace, pattern, searchScope, resultCollector, false );
|
||||
} catch (InterruptedException e) {
|
||||
//boo
|
||||
}
|
||||
|
@ -386,7 +386,9 @@ public class SearchRegressionTests extends BaseTestFramework implements ICSearch
|
|||
// test SE60b var all
|
||||
public void testVarReference() throws Exception {
|
||||
Writer writer = new StringWriter();
|
||||
writer.write("#include <string.h> \n" ); //$NON-NLS-1$
|
||||
// writer.write("#include <string.h> \n" ); //$NON-NLS-1$
|
||||
writer.write("int strlen( const char * ); \n" ); //$NON-NLS-1$
|
||||
writer.write("char * strcpy( char *, const char * ); \n" ); //$NON-NLS-1$
|
||||
writer.write("enum ZooLocs {ZOOANIMAL, BEAR, PANDA}; \n" ); //$NON-NLS-1$
|
||||
writer.write("namespace zoo { \n" ); //$NON-NLS-1$
|
||||
writer.write(" int foo=1;//vardefn, vardecl \n" ); //$NON-NLS-1$
|
||||
|
|
|
@ -22,8 +22,12 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
|||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.cdt.core.tests.BaseTestFramework;
|
||||
import org.eclipse.cdt.core.tests.FailingTest;
|
||||
import org.eclipse.cdt.internal.ui.CHelpProviderManager;
|
||||
import org.eclipse.cdt.internal.ui.text.CHelpBookDescriptor;
|
||||
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProcessor;
|
||||
import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.jface.text.Document;
|
||||
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||
|
@ -35,7 +39,7 @@ import junit.framework.TestSuite;
|
|||
* @author aniefer
|
||||
*/
|
||||
public class ContentAssistRegressionTests extends BaseTestFramework {
|
||||
|
||||
static boolean disabledHelpContributions = false;
|
||||
public ContentAssistRegressionTests()
|
||||
{
|
||||
super();
|
||||
|
@ -48,7 +52,23 @@ public class ContentAssistRegressionTests extends BaseTestFramework {
|
|||
super(name);
|
||||
}
|
||||
|
||||
protected ICompletionProposal[] getResults( IFile file, int offset ) throws Exception {
|
||||
private void disableContributions (){
|
||||
//disable the help books so we don't get proposals we weren't expecting
|
||||
final IProject proj = project;
|
||||
CHelpBookDescriptor helpBooks[];
|
||||
helpBooks = CHelpProviderManager.getDefault().getCHelpBookDescriptors(new ICHelpInvocationContext(){
|
||||
public IProject getProject(){return proj;}
|
||||
public ITranslationUnit getTranslationUnit(){return null;}
|
||||
}
|
||||
);
|
||||
for( int i = 0; i < helpBooks.length; i++ ){
|
||||
if( helpBooks[i] != null )
|
||||
helpBooks[i].enable( false );
|
||||
}
|
||||
}
|
||||
protected ICompletionProposal[] getResults( IFile file, int offset ) throws Exception {
|
||||
if( !disabledHelpContributions )
|
||||
disableContributions();
|
||||
ITranslationUnit tu = (ITranslationUnit)CoreModel.getDefault().create( file );
|
||||
String buffer = tu.getBuffer().getContents();
|
||||
IWorkingCopy wc = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue