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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-05-21 19:44:46 -07:00
parent 66131f1da6
commit a17d1225d1
3 changed files with 42 additions and 43 deletions

View file

@ -228,7 +228,7 @@ public class BaseSelectionTestsIndexer extends BaseUITestCase {
final IASTName[] result= {null}; final IASTName[] result= {null};
if (sel instanceof ITextSelection) { if (sel instanceof ITextSelection) {
final ITextSelection textSel = (ITextSelection)sel; final ITextSelection textSel = (ITextSelection)sel;
ITranslationUnit tu = (ITranslationUnit)editor.getInputCElement(); ITranslationUnit tu = editor.getInputCElement();
IStatus ok= ASTProvider.getASTProvider().runOnAST(tu, ASTProvider.WAIT_IF_OPEN, monitor, new ASTRunnable() { IStatus ok= ASTProvider.getASTProvider().runOnAST(tu, ASTProvider.WAIT_IF_OPEN, monitor, new ASTRunnable() {
@Override @Override
public IStatus runOnAST(ILanguage language, IASTTranslationUnit ast) throws CoreException { public IStatus runOnAST(ILanguage language, IASTTranslationUnit ast) throws CoreException {

View file

@ -34,7 +34,7 @@ import org.eclipse.cdt.ui.testplugin.CTestPlugin;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
/** /**
* Test Ctrl_F3/F3 with the DOM Indexer for a C++ project. * Test Ctrl-F3/F3 with the DOM Indexer for a C++ project.
*/ */
public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsIndexer { public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsIndexer {
private static final int MAX_WAIT_TIME = 8000; private static final int MAX_WAIT_TIME = 8000;
@ -984,6 +984,24 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
assertNode("gvar", offset0, decl); assertNode("gvar", offset0, decl);
} }
// #define MYMACRO
// #undef MYMACRO
public void testUndef_312399() throws Exception {
StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString();
String scode= buffers[1].toString();
IFile hfile = importFile("testUndef_312399.h", hcode);
IFile file = importFile("testUndef_312399.cpp", scode);
waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME);
IASTNode target = testF3(file, scode.indexOf("MYMACRO"));
assertTrue(target instanceof IASTName);
assertEquals("MYMACRO", ((IASTName) target).toString());
assertEquals(hcode.indexOf("MYMACRO"), target.getFileLocation().getNodeOffset());
assertEquals("MYMACRO".length(), ((ASTNode) target).getLength());
}
// int wurscht; // int wurscht;
// #include "aheader.h" // #include "aheader.h"
@ -1229,22 +1247,4 @@ public abstract class CPPSelectionTestsAnyIndexer extends BaseSelectionTestsInde
assertEquals("ambiguous input: 2", e.getMessage()); assertEquals("ambiguous input: 2", e.getMessage());
} }
} }
// #define MYMACRO
// #undef MYMACRO
public void testUndef_312399() throws Exception {
StringBuilder[] buffers= getContents(2);
String hcode= buffers[0].toString();
String scode= buffers[1].toString();
IFile hfile = importFile("testUndef_312399.h", hcode);
IFile file = importFile("testUndef_312399.cpp", scode);
waitUntilFileIsIndexed(index, file, MAX_WAIT_TIME);
IASTNode target = testF3(file, scode.indexOf("MYMACRO"));
assertTrue(target instanceof IASTName);
assertEquals("MYMACRO", ((IASTName) target).toString());
assertEquals(hcode.indexOf("MYMACRO"), target.getFileLocation().getNodeOffset());
assertEquals("MYMACRO".length(), ((ASTNode) target).getLength());
}
} }

View file

@ -8,7 +8,6 @@
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.tests.text.selection; package org.eclipse.cdt.ui.tests.text.selection;
import junit.framework.Test; import junit.framework.Test;