From ff4bfec701906f31bd66441a7373d23daa058db0 Mon Sep 17 00:00:00 2001 From: _tud <98935832+UnderscoreTud@users.noreply.github.com> Date: Sat, 23 Nov 2024 07:42:20 +0300 Subject: [PATCH] Handle invalid regex pattern in ExprJoinSplit (#7202) * handle invalid regex patterns * missing space in toString Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> --------- Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> --- .../regressions/7159-regex exceptions not handled.sk | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/test/skript/tests/regressions/7159-regex exceptions not handled.sk diff --git a/src/test/skript/tests/regressions/7159-regex exceptions not handled.sk b/src/test/skript/tests/regressions/7159-regex exceptions not handled.sk new file mode 100644 index 00000000000..691fe8e0da8 --- /dev/null +++ b/src/test/skript/tests/regressions/7159-regex exceptions not handled.sk @@ -0,0 +1,12 @@ +test "regex exceptions not handled": + parse: + set {_split::*} to regex split "test" at "\b{_name}\b" + assert last parse logs is "'\b{_name}\b' is not a valid regular expression" with "regex split did not error with invalid regex literal" + + set {_pattern} to "\b{_name}\b" + set {_split::*} to regex split "test" at {_pattern} + assert {_split::*} is not set with "regex split returned a value with invalid regex expression" + + assert regex split "apple,banana;cherry" at "[,;]" is "apple", "banana" and "cherry" with "regex split did not split correctly with literal" + set {_pattern} to "[,;]" + assert regex split "apple,banana;cherry" at {_pattern} is "apple", "banana" and "cherry" with "regex split did not split correctly with expression"