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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -474,7 +474,8 @@ public class CallHierarchyBugs extends CallHierarchyBaseTest {
openCallHierarchy(editor, false); openCallHierarchy(editor, false);
Tree chTree= checkTreeNode(ch, 0, "Base::dosomething()").getParent(); 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, 1, "Derived::dosomething()");
checkTreeNode(chTree, 0, 2, null); 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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$ IFile file = importFile( "t.cpp", contents ); //$NON-NLS-1$
int offset = contents.indexOf( "v/*vp1*/" ) ; //$NON-NLS-1$ int offset = contents.indexOf( "v/*vp1*/" ) ; //$NON-NLS-1$
Change changes = getRefactorChanges(file, offset, "ooga" ); //$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( 2, changes );
assertTotalChanges( 1, changes );
assertChange( changes, file, contents.indexOf("v/*vp1*/"), 1, "ooga" ); //$NON-NLS-1$//$NON-NLS-2$ 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 // defect is input for new name is not allowed
@ -605,10 +605,11 @@ public class RenameRegressionTests extends RenameTests {
//vp1 implicit virtual method //vp1 implicit virtual method
int offset = contents.indexOf( "v/*vp1*/" ) ; //$NON-NLS-1$ int offset = contents.indexOf( "v/*vp1*/" ) ; //$NON-NLS-1$
Change changes = getRefactorChanges(file, offset, "v1" ); //$NON-NLS-1$ Change changes = getRefactorChanges(file, offset, "v1" ); //$NON-NLS-1$
assertTotalChanges( 3, changes ); 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(){}"), 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/*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 { public void testMethod_45() throws Exception {
StringWriter writer = new StringWriter(); 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -152,4 +152,12 @@ public class RenameTests extends RefactoringTests {
} }
assertTrue(im.joinIndexer(10000, NPM)); 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -358,7 +358,6 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
"AMacro(x)", "AMacro(x)",
"DEBUG", "DEBUG",
"XMacro(x, y)", "XMacro(x, y)",
"_Pragma(arg)",
"__CDT_PARSER__", "__CDT_PARSER__",
"__DATE__", "__DATE__",
"__FILE__", "__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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -82,8 +82,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
OpenDeclarationsAction.sIsJUnitTest= true; OpenDeclarationsAction.sIsJUnitTest= true;
IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewReference[] refs= page.getViewReferences(); IViewReference[] refs= page.getViewReferences();
for (int i = 0; i < refs.length; i++) { for (IViewReference viewReference : refs) {
IViewReference viewReference = refs[i];
page.setPartState(viewReference, IWorkbenchPage.STATE_RESTORED); page.setPartState(viewReference, IWorkbenchPage.STATE_RESTORED);
} }
} }
@ -97,8 +96,8 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
message.append(status.getMessage()); message.append(status.getMessage());
if (status.isMultiStatus()) { if (status.isMultiStatus()) {
IStatus children[] = status.getChildren(); IStatus children[] = status.getChildren();
for (int i = 0; i < children.length; i++) { for (IStatus element : children) {
message.append(getMessage(children[i])); message.append(getMessage(element));
} }
} }
message.append("]"); //$NON-NLS-1$ message.append("]"); //$NON-NLS-1$
@ -112,9 +111,9 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
InputStream stream = new ByteArrayInputStream(contents.getBytes()); InputStream stream = new ByteArrayInputStream(contents.getBytes());
//Create file input stream //Create file input stream
if (file.exists()) if (file.exists())
file.setContents(stream, false, false, monitor); file.setContents(stream, true, false, monitor);
else else
file.create(stream, false, monitor); file.create(stream, true, monitor);
fileManager.addFile(file); fileManager.addFile(file);
@ -140,12 +139,12 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
//Create file input stream //Create file input stream
if (file.exists()) { if (file.exists()) {
long timestamp= file.getLocalTimeStamp(); long timestamp= file.getLocalTimeStamp();
file.setContents(stream, false, false, monitor); file.setContents(stream, true, false, monitor);
if (file.getLocalTimeStamp() == timestamp) { if (file.getLocalTimeStamp() == timestamp) {
file.setLocalTimeStamp(timestamp+1000); file.setLocalTimeStamp(timestamp+1000);
} }
} else { } else {
file.create(stream, false, monitor); file.create(stream, true, monitor);
} }
fileManager.addFile(file); fileManager.addFile(file);
@ -170,9 +169,9 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
InputStream stream = new ByteArrayInputStream(contents.getBytes()); InputStream stream = new ByteArrayInputStream(contents.getBytes());
//Create file input stream //Create file input stream
if (file.exists()) if (file.exists())
file.setContents(stream, false, false, monitor); file.setContents(stream, true, false, monitor);
else else
file.create(stream, false, monitor); file.create(stream, true, monitor);
fileManager.addFile(file); fileManager.addFile(file);
@ -204,7 +203,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart part = null; IEditorPart part = null;
try { try {
part = page.openEditor(new FileEditorInput(file), getEditorID(), true); //$NON-NLS-1$ part = page.openEditor(new FileEditorInput(file), getEditorID(), true);
} catch (PartInitException e) { } catch (PartInitException e) {
assertFalse(true); assertFalse(true);
} }
@ -255,7 +254,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart part = null; IEditorPart part = null;
try { try {
part = page.openEditor(new FileEditorInput(file), getEditorID()); //$NON-NLS-1$ part = page.openEditor(new FileEditorInput(file), getEditorID());
} catch (PartInitException e) { } catch (PartInitException e) {
assertFalse(true); assertFalse(true);
} }
@ -289,7 +288,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart part = null; IEditorPart part = null;
try { try {
part = page.openEditor(new FileEditorInput(file), getEditorID()); //$NON-NLS-1$ part = page.openEditor(new FileEditorInput(file), getEditorID());
} catch (PartInitException e) { } catch (PartInitException e) {
assertFalse(true); assertFalse(true);
} }