use new logmsg and set --show in tests

This commit is contained in:
Kurtis Rader 2017-08-03 20:56:14 -07:00
parent ec884f4bfd
commit ecf06f2eb4
3 changed files with 29 additions and 20 deletions

View file

@ -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

View file

@ -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

View file

@ -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