1 46 47 package groovy.bugs; 48 49 import groovy.lang.GroovyShell; 50 51 import org.codehaus.groovy.classgen.TestSupport; 52 53 57 public class SeansBug extends TestSupport { 58 59 public void testBug() throws Exception { 60 String code = "for (i in 1..10) \n{\n println(i)\n}"; 61 GroovyShell shell = new GroovyShell(); 62 shell.evaluate(code); 63 } 64 65 public void testMarkupBug() throws Exception { 66 String [] lines = 67 { 68 "package groovy.xml", 69 "", 70 "b = new MarkupBuilder()", 71 "", 72 "b.root1(a:5, b:7) { ", 73 " elem1('hello1') ", 74 " elem2('hello2') ", 75 " elem3(x:7) ", 76 "}" }; 77 String code = asCode(lines); 78 GroovyShell shell = new GroovyShell(); 79 shell.evaluate(code); 80 } 81 82 85 protected String asCode(String [] lines) { 86 StringBuffer buffer = new StringBuffer (); 87 for (int i = 0; i < lines.length; i++) { 88 buffer.append(lines[i]); 89 buffer.append("\n"); 90 } 91 return buffer.toString(); 92 } 93 } 94 | Popular Tags |