mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 04:02:09 +08:00
enhancement 补充测试用例,调整 ElRegexUtil.normalize 方法逻辑
This commit is contained in:
@@ -57,12 +57,13 @@ public class ElRegexUtil {
|
||||
|
||||
/**
|
||||
* 规范化 EL
|
||||
*
|
||||
* @param elStr
|
||||
* @return String
|
||||
*/
|
||||
public static String normalize(String elStr) {
|
||||
// 替换 EL 中多余空格,并在末尾保留分号
|
||||
return elStr.replaceAll("\\s", "").replaceFirst(";*$", ";");
|
||||
// 剔除 EL 中多余空格,且将单引号变为双引号,并在末尾保留一个分号
|
||||
return elStr.replace("'", "\"").replaceAll("\\s", "").replaceFirst(";*$", ";");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,6 +96,12 @@ public class BaseELSpringbootTest extends BaseTest {
|
||||
Assertions.assertTrue(response.isSuccess());
|
||||
// 应返回 chain2
|
||||
Assertions.assertEquals("chain2", response.getChainId());
|
||||
|
||||
LiteflowResponse response1 = flowExecutor.execute2RespWithEL("t1=THEN(c, WHEN(j,k));w1 = WHEN(q, THEN(p, r)).id('w01');t2 = THEN(h, i);\n" +
|
||||
"THEN(a,b,WHEN(t1, d, t2 ),SWITCH(x).to(m, n, w1),z);");
|
||||
Assertions.assertTrue(response1.isSuccess());
|
||||
// 应返回 chain5
|
||||
Assertions.assertEquals("chain5", response1.getChainId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user