1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Work on the DOM builder - simple declaration and declSpecifiers but

no declarator yet.
This commit is contained in:
Doug Schaefer 2003-02-11 15:49:46 +00:00
parent ee9110f2e4
commit 6cc8fcf0b7

View file

@ -0,0 +1,28 @@
package org.eclipse.cdt.debug.core.tests;
import java.util.List;
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
import org.eclipse.cdt.internal.core.dom.SimpleDeclaration;
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
import org.eclipse.cdt.internal.core.newparser.Parser;
import junit.framework.TestCase;
/**
* Tests the construction of DOMs for snippets of code
*/
public class DOMTests extends TestCase {
public void testIntX() throws Exception {
DOMBuilder domBuilder = new DOMBuilder();
Parser parser = new Parser("int x;", domBuilder);
parser.parse();
TranslationUnit translationUnit = domBuilder.getTranslationUnit();
List declarations = translationUnit.getDeclarations();
assertEquals(1, declarations.size());
SimpleDeclaration declaration = (SimpleDeclaration)declarations.get(0);
assertEquals(SimpleDeclaration.t_int, declaration.getDeclSpecifierSeq());
}
}