mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 04:13:08 +00:00
fix set --show
of semi-empty var
A semi-empty var is one with a single empty string element. The `env_var_t::empty()` method returns true for such vars but we want `set --show` to report that it has a single empty element.
This commit is contained in:
parent
dcb39bfa86
commit
ea45541d53
4 changed files with 11 additions and 2 deletions
|
@ -539,7 +539,7 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams
|
|||
|
||||
const env_var_t var = env_get(var_name, scope | ENV_USER);
|
||||
wcstring_list_t result;
|
||||
if (!var.empty()) var.to_list(result);
|
||||
var.to_list(result);
|
||||
|
||||
streams.out.append_format(_(L"$%ls: set in %ls scope, %ls, with %d elements\n"), var_name,
|
||||
scope_name, exportv, result.size());
|
||||
|
|
|
@ -4,6 +4,9 @@ logmsg Verify behavior of `set --show` given an invalid var name
|
|||
set --show 'argle bargle'
|
||||
|
||||
logmsg Verify behavior of `set --show`
|
||||
set semiempty ''
|
||||
set --show semiempty
|
||||
|
||||
set -U var1 hello
|
||||
set --show var1
|
||||
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
####################
|
||||
# Verify behavior of `set --show`
|
||||
$semiempty: not set in local scope
|
||||
$semiempty: set in global scope, unexported, with 1 elements
|
||||
$semiempty[1]: length=0 value=||
|
||||
$semiempty: not set in universal scope
|
||||
|
||||
$var1: not set in local scope
|
||||
$var1: not set in global scope
|
||||
$var1: set in universal scope, unexported, with 1 elements
|
||||
|
|
|
@ -17,7 +17,8 @@ $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: set in global scope, unexported, with 1 elements
|
||||
$c[1]: length=0 value=||
|
||||
$c: not set in universal scope
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue