提交 b9623951 编写于 作者: Y yumin.pym

format test code

上级 6146d838
......@@ -208,15 +208,15 @@ public class ExpressRunner {
/**
* 装载表达式,但不执行,例如一些宏定义,或者自定义函数
*
* @param groupName
* @param expressName
* @param express
* @throws Exception
*/
public void loadMultiExpress(String groupName, String express) throws Exception {
if (groupName == null || groupName.trim().length() == 0) {
groupName = GLOBAL_DEFINE_NAME;
public void loadMultiExpress(String expressName, String express) throws Exception {
if (expressName == null || expressName.trim().length() == 0) {
expressName = GLOBAL_DEFINE_NAME;
}
this.loader.parseInstructionSet(groupName, express);
this.loader.parseInstructionSet(expressName, express);
}
/**
......
......@@ -192,12 +192,12 @@ public class DemoShowTest {
@Test
public void testVirtualClass() throws Exception {
ExpressRunner runner = new ExpressRunner(false, true);
runner.loadMultiExpress("类初始化", "class People(){sex;height;money;skin};");
runner.loadMultiExpress("创建小强", "a = new People();a.sex='male';a.height=185;a.money=10000000;");
runner.loadMultiExpress("体检", "if(a.sex=='male' && a.height>180 && a.money>5000000) return '高富帅,鉴定完毕'");
DefaultContext<String, Object> context = new DefaultContext<>();
runner.loadMultiExpress("类初始化", "class People(){sex; height; money; skin};");
runner.loadMultiExpress("创建小强", "a = new People(); a.sex = 'male'; a.height = 185; a.money = 10000000;");
runner.loadMultiExpress("体检", "if(a.sex == 'male' && a.height > 180 && a.money > 5000000) return '高富帅,鉴定完毕';");
Object r = runner.execute("类初始化;创建小强;体检", context, null, false, false);
System.out.println(r);
DefaultContext<String, Object> context = new DefaultContext<>();
Object result = runner.execute("类初始化;创建小强;体检", context, null, false, false);
System.out.println(result);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册