compilabletestsupport.groovy
来自「Groovy动态语言 运行在JVM中的动态语言 可以方便的处理业务逻辑变化大的业」· GROOVY 代码 · 共 23 行
GROOVY
23 行
package gls.scope
import org.codehaus.groovy.control.CompilationFailedException;
import groovy.util.GroovyTestCase;
public class CompilableTestSupport extends GroovyTestCase {
protected void shouldNotCompile(String script) {
try {
GroovyShell shell = new GroovyShell()
shell.parse(script, getTestClassName())
} catch (CompilationFailedException cfe) {
assert true
return
}
fail("the compilation succeeded but should have failed")
}
protected void shouldCompile(String script) {
GroovyShell shell = new GroovyShell()
shell.parse(script, getTestClassName())
assert true
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?