Fix set --local when var is not in local scope

Fixes #4321
This commit is contained in:
Kurtis Rader
2017-08-19 21:39:21 -07:00
parent 335f397277
commit 704517e237
4 changed files with 23 additions and 2 deletions

View File

@@ -14,3 +14,6 @@ $argle bargle: invalid var name
####################
# Appending and prepending at same time works
####################
# Setting local scope when no local scope of the var uses the closest scope

View File

@@ -47,3 +47,10 @@ logmsg Appending and prepending at same time works
set -g var5 abc def
set -a -p var5 0 x 0
set --show var5
logmsg Setting local scope when no local scope of the var uses the closest scope
set -g var6 ghi jkl
begin
set -l -a var6 mno
set --show var6
end

View File

@@ -88,3 +88,15 @@ $var5[7]: length=1 value=|x|
$var5[8]: length=1 value=|0|
$var5: not set in universal scope
####################
# Setting local scope when no local scope of the var uses the closest scope
$var6: set in local scope, unexported, with 3 elements
$var6[1]: length=3 value=|ghi|
$var6[2]: length=3 value=|jkl|
$var6[3]: length=3 value=|mno|
$var6: set in global scope, unexported, with 2 elements
$var6[1]: length=3 value=|ghi|
$var6[2]: length=3 value=|jkl|
$var6: not set in universal scope