2
0
Fork 0
mirror of https://github.com/fish-shell/fish-shell synced 2025-02-01 06:43:39 +00:00

string: add tests for empty capture groups

As seen in .
This commit is contained in:
David Adam 2019-05-29 23:14:19 +08:00
parent 97507a24a2
commit 78d015bd61
3 changed files with 14 additions and 0 deletions

View file

@ -176,6 +176,9 @@
#################### ####################
# string replace --regex -f "\d" X 1bc axc 2 d3f jk4 xyz # string replace --regex -f "\d" X 1bc axc 2 d3f jk4 xyz
####################
# string match -r with empty capture groups
#################### ####################
# string match -r "[" "a[sd" # string match -r "[" "a[sd"
string match: Regular expression compile error: missing terminating ] for character class string match: Regular expression compile error: missing terminating ] for character class

View file

@ -203,6 +203,10 @@ or echo Unexpected exit status at line (status --current-line-number)
string replace --regex -f "Z" X 1bc axc 2 d3f jk4 xyz string replace --regex -f "Z" X 1bc axc 2 d3f jk4 xyz
and echo Unexpected exit status at line (status --current-line-number) and echo Unexpected exit status at line (status --current-line-number)
# From https://github.com/fish-shell/fish-shell/issues/5201
logmsg 'string match -r with empty capture groups'
string match -r '^([ugoa]*)([=+-]?)([rwx]*)$' '=r'
# test some failure cases # test some failure cases
logmsg 'string match -r "[" "a[sd"' logmsg 'string match -r "[" "a[sd"'
string match -r "[" "a[sd"; and echo "unexpected exit 0" string match -r "[" "a[sd"; and echo "unexpected exit 0"

View file

@ -274,6 +274,13 @@ X
dXf dXf
jkX jkX
####################
# string match -r with empty capture groups
=r
=
r
#################### ####################
# string match -r "[" "a[sd" # string match -r "[" "a[sd"