mirror of
https://gitee.com/dromara/hutool.git
synced 2025-09-21 02:58:11 +08:00
clean history
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package cn.hutool.script.test;
|
||||
|
||||
import javax.script.CompiledScript;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import cn.hutool.script.ScriptRuntimeException;
|
||||
import cn.hutool.script.ScriptUtil;
|
||||
|
||||
/**
|
||||
* 脚本单元测试类
|
||||
*
|
||||
* @author looly
|
||||
*
|
||||
*/
|
||||
public class ScriptUtilTest {
|
||||
|
||||
@Test
|
||||
public void compileTest() {
|
||||
CompiledScript script = ScriptUtil.compile("print('Script test!');");
|
||||
try {
|
||||
script.eval();
|
||||
} catch (ScriptException e) {
|
||||
throw new ScriptRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void evalTest() {
|
||||
ScriptUtil.eval("print('Script test!');");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user