1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix testcases.

This commit is contained in:
Markus Schorn 2010-02-16 16:04:34 +00:00
parent 2fa73f9d8f
commit e6968d589b
5 changed files with 33 additions and 25 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* 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
@ -474,7 +474,8 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
openCallHierarchy(editor, false);
Tree chTree= checkTreeNode(ch, 0, "Base::dosomething()").getParent();
checkTreeNode(chTree, 0, 0, "Base::dosomething()");
TreeItem item= checkTreeNode(chTree, 0, 0, "Base::dosomething()");
expandTreeItem(item);
checkTreeNode(chTree, 0, 1, "Derived::dosomething()");
checkTreeNode(chTree, 0, 2, null);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2009 IBM Corporation and others.
* Copyright (c) 2004, 2010 IBM Corporation and others.
* 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
@ -417,9 +417,9 @@ public class RenameRegressionTests extends RenameTests {
IFile file = importFile( "t.cpp", contents ); //$NON-NLS-1$
int offset = contents.indexOf( "v/*vp1*/" ) ; //$NON-NLS-1$
Change changes = getRefactorChanges(file, offset, "ooga" ); //$NON-NLS-1$
//dervied method is not renamed; only a warning to rename derived or base class methods
assertTotalChanges( 1, changes );
assertTotalChanges( 2, changes );
assertChange( changes, file, contents.indexOf("v/*vp1*/"), 1, "ooga" ); //$NON-NLS-1$//$NON-NLS-2$
assertChange( changes, file, contents.indexOf("v(){}"), 1, "ooga" ); //$NON-NLS-1$//$NON-NLS-2$
}
// defect is input for new name is not allowed
@ -605,10 +605,11 @@ public class RenameRegressionTests extends RenameTests {
//vp1 implicit virtual method
int offset = contents.indexOf( "v/*vp1*/" ) ; //$NON-NLS-1$
Change changes = getRefactorChanges(file, offset, "v1" ); //$NON-NLS-1$
assertTotalChanges( 3, changes );
assertChange( changes, file, contents.indexOf("v()"), 1, "v1" ); //$NON-NLS-1$//$NON-NLS-2$
assertTotalChanges( 4, changes );
assertChange( changes, file, contents.indexOf("v();"), 1, "v1" ); //$NON-NLS-1$//$NON-NLS-2$
assertChange( changes, file, contents.indexOf("v(){}"), 1, "v1" ); //$NON-NLS-1$//$NON-NLS-2$
assertChange( changes, file, contents.indexOf("v/*vp1*/"), 1, "v1" ); //$NON-NLS-1$//$NON-NLS-2$
assertChange( changes, file, contents.indexOf("v(){"), 1, "v1" ); //$NON-NLS-1$//$NON-NLS-2$
assertChange( changes, file, contents.indexOf("v(){i++;}"), 1, "v1" ); //$NON-NLS-1$//$NON-NLS-2$
}
public void testMethod_45() throws Exception {
StringWriter writer = new StringWriter();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2008 Wind River Systems, Inc.
* Copyright (c) 2005, 2010 Wind River Systems, Inc.
* 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
@ -152,4 +152,12 @@ public class RenameTests extends RefactoringTests {
}
assertTrue(im.joinIndexer(10000, NPM));
}
@Override
protected IFile importFile(String fileName, String contents)
throws Exception {
IFile result= super.importFile(fileName, contents);
waitForIndexer();
return result;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* 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
@ -358,7 +358,6 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
"AMacro(x)",
"DEBUG",
"XMacro(x, y)",
"_Pragma(arg)",
"__CDT_PARSER__",
"__DATE__",
"__FILE__",

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2009 IBM Corporation and others.
* Copyright (c) 2005, 2010 IBM Corporation and others.
* 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
@ -82,8 +82,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
OpenDeclarationsAction.sIsJUnitTest= true;
IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewReference[] refs= page.getViewReferences();
for (int i = 0; i < refs.length; i++) {
IViewReference viewReference = refs[i];
for (IViewReference viewReference : refs) {
page.setPartState(viewReference, IWorkbenchPage.STATE_RESTORED);
}
}
@ -97,8 +96,8 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
message.append(status.getMessage());
if (status.isMultiStatus()) {
IStatus children[] = status.getChildren();
for (int i = 0; i < children.length; i++) {
message.append(getMessage(children[i]));
for (IStatus element : children) {
message.append(getMessage(element));
}
}
message.append("]"); //$NON-NLS-1$
@ -112,9 +111,9 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
InputStream stream = new ByteArrayInputStream(contents.getBytes());
//Create file input stream
if (file.exists())
file.setContents(stream, false, false, monitor);
file.setContents(stream, true, false, monitor);
else
file.create(stream, false, monitor);
file.create(stream, true, monitor);
fileManager.addFile(file);
@ -140,12 +139,12 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
//Create file input stream
if (file.exists()) {
long timestamp= file.getLocalTimeStamp();
file.setContents(stream, false, false, monitor);
file.setContents(stream, true, false, monitor);
if (file.getLocalTimeStamp() == timestamp) {
file.setLocalTimeStamp(timestamp+1000);
}
} else {
file.create(stream, false, monitor);
file.create(stream, true, monitor);
}
fileManager.addFile(file);
@ -170,9 +169,9 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
InputStream stream = new ByteArrayInputStream(contents.getBytes());
//Create file input stream
if (file.exists())
file.setContents(stream, false, false, monitor);
file.setContents(stream, true, false, monitor);
else
file.create(stream, false, monitor);
file.create(stream, true, monitor);
fileManager.addFile(file);
@ -204,7 +203,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart part = null;
try {
part = page.openEditor(new FileEditorInput(file), getEditorID(), true); //$NON-NLS-1$
part = page.openEditor(new FileEditorInput(file), getEditorID(), true);
} catch (PartInitException e) {
assertFalse(true);
}
@ -255,7 +254,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart part = null;
try {
part = page.openEditor(new FileEditorInput(file), getEditorID()); //$NON-NLS-1$
part = page.openEditor(new FileEditorInput(file), getEditorID());
} catch (PartInitException e) {
assertFalse(true);
}
@ -289,7 +288,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart part = null;
try {
part = page.openEditor(new FileEditorInput(file), getEditorID()); //$NON-NLS-1$
part = page.openEditor(new FileEditorInput(file), getEditorID());
} catch (PartInitException e) {
assertFalse(true);
}