-
-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle invalid regex pattern in ExprJoinSplit (#7202)
* 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
1 parent
91e8b93
commit 9111b87
Showing
2 changed files
with
61 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/test/skript/tests/regressions/7159-regex exceptions not handled.sk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |