diff --git a/tests/test_cmdsub.err b/tests/test_cmdsub.err index c77650283..1648a2365 100644 --- a/tests/test_cmdsub.err +++ b/tests/test_cmdsub.err @@ -1,9 +1,10 @@ -# Command sub at the limit should fail. +# Command sub just under the limit should succeed +# Command sub at the limit should fail fish: Too much data emitted by command substitution so it was discarded set b (string repeat -n 512 x) ^ -# Command sub over the limit should fail. +# Command sub over the limit should fail fish: Too much data emitted by command substitution so it was discarded set -l x (string repeat -n $argv x) @@ -15,6 +16,7 @@ in function 'subme' in command substitution called on standard input +# Make sure output from builtins outside of command substitution is not affected # Same builtin in a command substitution is affected fish: Too much data emitted by command substitution so it was discarded diff --git a/tests/test_cmdsub.in b/tests/test_cmdsub.in index 7ec83e305..29507a7f0 100644 --- a/tests/test_cmdsub.in +++ b/tests/test_cmdsub.in @@ -8,27 +8,25 @@ function subme echo $x end -echo '# Command sub just under the limit should succeed.' +logmsg Command sub just under the limit should succeed set a (subme 511) -show a +set --show a -echo '# Command sub at the limit should fail.' -echo '# Command sub at the limit should fail.' >&2 +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 -show b +set --show b -echo '# Command sub over the limit should fail.' -echo '# Command sub over the limit should fail.' >&2 +logmsg Command sub over the limit should fail set c (subme 513) -show c +set --show c -echo '# Make sure output from builtins outside of command substitution is not affected' +logmsg Make sure output from builtins outside of command substitution is not affected string repeat --max 513 a -echo '# Same builtin in a command substitution is affected' >&2 +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 diff --git a/tests/test_cmdsub.out b/tests/test_cmdsub.out index 442f922f0..e795beea0 100644 --- a/tests/test_cmdsub.out +++ b/tests/test_cmdsub.out @@ -1,10 +1,19 @@ -# Command sub just under the limit should succeed. -$a count=1 -$a[1]=|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| -# Command sub at the limit should fail. -$b is not set -# Command sub over the limit should fail. -$c count=1 -$c[1]=|| +# Command sub just under the limit should succeed +$a: not set in local scope +$a: set in global scope, unexported, with 1 elements +$a[0]: length=511 value=|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| +$a: not set in universal scope + +# Command sub at the limit should fail +$b: not set in local scope +$b: not set in global scope +$b: not set in universal scope + +# Command sub over the limit should fail +$c: not set in local scope +$c: set in global scope, unexported, with 0 elements +$c: not set in universal scope + # Make sure output from builtins outside of command substitution is not affected aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +# Same builtin in a command substitution is affected