Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

针对[return -50],如果return后面跟一个负数值时程序解析错误 #7

Closed
truechuan opened this issue Oct 18, 2017 · 1 comment

Comments

@truechuan
Copy link

@Test
public void testChange_1() throws Exception {
    ExpressRunner runner = RuleEngine.newInstance();
    IExpressContext<String, Object> context = new DefaultContext<String, Object>();
    context.put("test", 2.004);
    String test = "if(test > 0){return 50}";
    System.out.println(runner.execute(test, context, null, true, false));

    String test1 = "if(test > 0){return -50}";
    System.out.println(runner.execute(test1, context, null, true, false));
}

从测试用例得出test1执行失败,具体原因应该是在ExpressParse.transferWord2ExpressNode 对'-'这种特殊情况考虑不够。

@truechuan truechuan changed the title 针对return 一个负数程序解析错误 针对[return -50],如果return后面跟一个负数值时程序解析错误 Oct 18, 2017
@baoxingjie
Copy link
Contributor

you are right,i have fixed the minus problem at version 3.1.5 ,here is the test
https://github.com/alibaba/QLExpress/blob/master/src/test/java/com/ql/util/express/test/MinusOperatorTest.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants