mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-30 14:24:35 +08:00
7be8a1707c
Fixes #4414
34 lines
932 B
Fish
34 lines
932 B
Fish
# This tests various corner cases involving command substitution. Most
|
|
# importantly the limits on the amount of data we'll substitute.
|
|
|
|
set fish_read_limit 512
|
|
|
|
function subme
|
|
set -l x (string repeat -n $argv x)
|
|
echo $x
|
|
end
|
|
|
|
logmsg Command sub just under the limit should succeed
|
|
set a (subme 511)
|
|
set --show a
|
|
|
|
logmsg Command sub at the limit should fail
|
|
set b (string repeat -n 512 x)
|
|
set saved_status $status
|
|
test $saved_status -eq 122
|
|
or echo expected status 122, saw $saved_status >&2
|
|
set --show b
|
|
|
|
logmsg Command sub over the limit should fail
|
|
set c (subme 513)
|
|
set --show c
|
|
|
|
logmsg Make sure output from builtins outside of command substitution is not affected
|
|
string repeat --max 513 a
|
|
|
|
logmsg Same builtin in a command substitution is affected
|
|
echo this will fail (string repeat --max 513 b) to output anything
|
|
set saved_status $status
|
|
test $saved_status -eq 122
|
|
or echo expected status 122, saw $saved_status >&2
|