1 46 package org.codehaus.groovy.ast; 47 48 import java.util.List ; 49 50 import org.codehaus.groovy.syntax.parser.TestParserSupport; 51 52 58 public class ModuleNodeTest extends TestParserSupport { 59 60 public void testStatementClass() throws Exception { 61 ModuleNode module = parse("x = [1, 2, 3]; println(x)", "Cheese.groovy"); 62 63 assertTrue("Should have statements", ! module.getStatementBlock().isEmpty()); 64 65 List classes = module.getClasses(); 66 assertEquals("Number of classes", 1, classes.size()); 67 68 ClassNode classNode = (ClassNode) classes.get(0); 69 70 assertEquals("Class name", "Cheese", classNode.getName()); 71 } 72 } 73 | Popular Tags |