mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
2974025010
The span now properly points at the token that was invalid, rather than the start of the slice. Also fix the span for `()[1]` and `()[d]`, which were previously reporting no source location at all.
82 lines
1.1 KiB
Text
82 lines
1.1 KiB
Text
# Test expansion of variables
|
|
|
|
function show --description 'Prints argument count followed by arguments'
|
|
echo (count $argv) $argv
|
|
end
|
|
|
|
set -l foo
|
|
show "$foo"
|
|
show $foo
|
|
show "prefix$foo"
|
|
show prefix$foo
|
|
|
|
show "$$foo"
|
|
show $$foo
|
|
show "prefix$$foo"
|
|
show prefix$$foo
|
|
|
|
set -l foo ''
|
|
show "$foo"
|
|
show $foo
|
|
show "prefix$foo"
|
|
show prefix$foo
|
|
|
|
show "$$foo"
|
|
show $$foo
|
|
show "prefix$$foo"
|
|
show prefix$$foo
|
|
|
|
set -l foo bar
|
|
set -l bar
|
|
show "$$foo"
|
|
show $$foo
|
|
show "prefix$$foo"
|
|
show prefix$$foo
|
|
|
|
set -l bar baz
|
|
show "$$foo"
|
|
show $$foo
|
|
show "prefix$$foo"
|
|
show prefix$$foo
|
|
|
|
set -l bar baz quux
|
|
show "$$foo"
|
|
show $$foo
|
|
show "prefix$$foo"
|
|
show prefix$$foo
|
|
|
|
set -l foo bar fooer fooest
|
|
set -l fooer
|
|
set -l fooest
|
|
show "$$foo"
|
|
show $$foo
|
|
show "prefix$$foo"
|
|
show prefix$$foo
|
|
|
|
set -l fooer ''
|
|
show $$foo
|
|
show prefix$$foo
|
|
|
|
set -l foo bar '' fooest
|
|
show "$$foo"
|
|
show $$foo
|
|
show "prefix$$foo"
|
|
show prefix$$foo
|
|
|
|
set -l foo
|
|
show "$foo[1]"
|
|
show $foo[1]
|
|
show "$foo[-1]"
|
|
show $foo[-1]
|
|
show "$foo[2]"
|
|
show $foo[2]
|
|
show "$foo[1 2]"
|
|
show $foo[1 2]
|
|
show "$foo[2 1]"
|
|
show $foo[2 1]
|
|
|
|
echo "$foo[d]"
|
|
echo $foo[d]
|
|
|
|
echo ()[1]
|
|
echo ()[d]
|