01: /**
02: * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03: */package test.net.sourceforge.pmd.symboltable;
04:
05: import static org.junit.Assert.assertTrue;
06: import net.sourceforge.pmd.PMD;
07: import net.sourceforge.pmd.ast.ASTIfStatement;
08: import net.sourceforge.pmd.symboltable.LocalScope;
09:
10: import org.junit.Test;
11:
12: public class ScopeCreationVisitorTest extends STBBaseTst {
13:
14: @Test
15: public void testScopesAreCreated() {
16: parseCode(TEST1);
17: ASTIfStatement n = acu.findChildrenOfType(ASTIfStatement.class)
18: .get(0);
19: assertTrue(n.getScope() instanceof LocalScope);
20: }
21:
22: private static final String TEST1 = "public class Foo {" + PMD.EOL
23: + " void foo() {" + PMD.EOL + " if (x>2) {}" + PMD.EOL
24: + " }" + PMD.EOL + "}" + PMD.EOL;
25:
26: public static junit.framework.Test suite() {
27: return new junit.framework.JUnit4TestAdapter(
28: ScopeCreationVisitorTest.class);
29: }
30: }
|