diff options
Diffstat (limited to 'core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseTest.java')
-rw-r--r-- | core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseTest.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseTest.java index 9d59cf1c8b2..ac21a5487f7 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/DOMSelectionParseTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2010 IBM Corporation and others. + * Copyright (c) 2002, 2013 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 @@ -8,6 +8,7 @@ * Contributors: * IBM Rational Software - Initial API and implementation * Markus Schorn (Wind River Systems) + * Nathan Ridge *******************************************************************************/ package org.eclipse.cdt.core.parser.tests.ast2; @@ -37,6 +38,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil; import org.eclipse.cdt.internal.core.model.CProject; import org.eclipse.core.resources.IFile; @@ -296,8 +298,12 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest { } IASTNode node = parse( code, startOffset, endOffset ); assertTrue( node instanceof IASTName ); - assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod ); IBinding binding = ((IASTName)node).resolveBinding(); + if (binding instanceof ICPPClassType) { + node = TestUtil.findImplicitName(node); + binding = ((IASTName)node).resolveBinding(); + } + assertTrue( binding instanceof ICPPMethod ); IName[] decls = null; switch( i ) { @@ -599,14 +605,15 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest { int startIndex = code.indexOf( "new B" ) + 4; //$NON-NLS-1$ IASTNode node = parse( code, startIndex, startIndex + 1 ); + node = TestUtil.findImplicitName(node); assertTrue( node instanceof IASTName ); - assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPConstructor ); + assertTrue( ((IASTName) node).resolveBinding() instanceof ICPPConstructor ); assertEquals( ((IASTName)node).toString(), "B" ); //$NON-NLS-1$ IName[] decls = getDeclarationOffTU((IASTName)node); assertEquals(decls.length, 1); assertEquals( decls[0].toString(), "B" ); //$NON-NLS-1$ - assertEquals( ((ASTNode)decls[0]).getOffset(), 17); - assertEquals( ((ASTNode)decls[0]).getLength(), 1); + assertEquals( 17, ((ASTNode)decls[0]).getOffset() ); + assertEquals( 1, ((ASTNode)decls[0]).getLength() ); } public void testBug72712_2() throws Exception{ @@ -1111,8 +1118,9 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest { int index = code.indexOf("Point(10)"); //$NON-NLS-1$ IASTNode node = parse( code, index, index + 5, true ); + node = TestUtil.findImplicitName(node); assertTrue( node instanceof IASTName ); - assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPConstructor ); + assertTrue( ((IASTName) node).resolveBinding() instanceof ICPPConstructor ); assertEquals( ((IASTName)node).toString(), "Point" ); //$NON-NLS-1$ IName[] decls = getDeclarationOffTU((IASTName)node); |