Skip to content

Commit

Permalink
Handle invalid regex pattern in ExprJoinSplit (SkriptLang#7202)
Browse files Browse the repository at this point in the history
* handle invalid regex patterns

* missing space in toString

Co-authored-by: Efnilite <[email protected]>

---------

Co-authored-by: Efnilite <[email protected]>
Co-authored-by: sovdee <[email protected]>
  • Loading branch information
3 people authored and Burbulinis committed Dec 3, 2024
1 parent 44a5f24 commit ff4bfec
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit ff4bfec

Please sign in to comment.