View Javadoc
1 package test.net.sourceforge.pmd.symboltable; 2 3 import junit.framework.TestCase; 4 import net.sourceforge.pmd.ast.ASTLocalVariableDeclaration; 5 import net.sourceforge.pmd.ast.ASTVariableDeclarator; 6 import net.sourceforge.pmd.ast.ASTVariableDeclaratorId; 7 import net.sourceforge.pmd.ast.SimpleNode; 8 import net.sourceforge.pmd.symboltable.DeclarationFinder; 9 import net.sourceforge.pmd.symboltable.LocalScope; 10 import net.sourceforge.pmd.symboltable.NameOccurrence; 11 12 public class DeclarationFinderTest extends TestCase { 13 14 public void testDeclarationsAreFound() { 15 DeclarationFinder df = new DeclarationFinder(); 16 17 ASTVariableDeclaratorId node = new ASTVariableDeclaratorId(1); 18 node.setImage("foo"); 19 20 ASTVariableDeclarator parent = new ASTVariableDeclarator(2); 21 node.jjtSetParent(parent); 22 23 ASTLocalVariableDeclaration gparent = new ASTLocalVariableDeclaration(3); 24 parent.jjtSetParent(gparent); 25 26 LocalScope scope = new LocalScope(); 27 node.setScope(scope); 28 df.visit(node, null); 29 30 assertTrue(scope.contains(new NameOccurrence(new SimpleNode(4), "foo"))); 31 } 32 33 public void test1() { 34 } 35 }

This page was automatically generated by Maven