mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 13:01:21 -03:00
Add a test for invalid regex variable names
Also apply some mild refactoring.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#RUN: %fish %s
|
||||
# Tests for importing named regex groups as fish variables
|
||||
|
||||
# Invalid variable name?
|
||||
string match --regex -q '(?<FISH_VERSION>.*)' -- derp
|
||||
# CHECKERR: Modification of read-only variable "FISH_VERSION" is not allowed
|
||||
|
||||
# Capture first match
|
||||
echo "hello world" | string match --regex -q -- '(?<words>[^ ]+) ?'
|
||||
printf "%s\n" $words
|
||||
|
||||
Reference in New Issue
Block a user