mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Work on the DOM builder - simple declaration and declSpecifiers but
no declarator yet.
This commit is contained in:
parent
ee9110f2e4
commit
6cc8fcf0b7
1 changed files with 28 additions and 0 deletions
|
@ -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());
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue