Fix switch js, add black key (#15680)

Co-authored-by: fuchanghai <changhaifu@apache.org>
Co-authored-by: Eric Gao <ericgao.apache@gmail.com>
This commit is contained in:
caishunfeng 2024-03-18 20:24:54 +08:00 committed by GitHub
parent faa794c39b
commit 4a255fd523
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -50,6 +50,10 @@ public class SwitchTaskUtils {
"eval",
"function",
"import",
".",
"()",
"[",
"]",
"\\\\");
static {

View File

@ -65,5 +65,15 @@ public class SwitchTaskUtilsTest {
SwitchTaskUtils.generateContentWithTaskParams(contentWithUnicode, globalParams, varParams);
});
String contentWithSpecify1 = "cmd.abc";
Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> {
SwitchTaskUtils.generateContentWithTaskParams(contentWithSpecify1, globalParams, varParams);
});
String contentWithSpecify2 = "cmd()";
Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> {
SwitchTaskUtils.generateContentWithTaskParams(contentWithSpecify2, globalParams, varParams);
});
}
}