Test setting readonly variables

This commit is contained in:
Fabian Homborg 2018-11-18 22:32:43 +01:00
parent 8730b482a7
commit 1ab84ac62a
3 changed files with 13 additions and 0 deletions

View file

@ -23,3 +23,7 @@ $argle bargle: invalid var name
#################### ####################
# if/for/while scope # if/for/while scope
####################
# readonly vars
set: Tried to change the read-only variable 'status'

View file

@ -70,3 +70,9 @@ function test_ifforwhile_scope
set --show ifvar1 ifvar2 ifvar3 whilevar1 set --show ifvar1 ifvar2 ifvar3 whilevar1
end end
test_ifforwhile_scope test_ifforwhile_scope
# $status should always be read-only, setting it makes no sense because it's immediately overwritten.
logmsg readonly vars
set -g status 5
exit 0

View file

@ -129,3 +129,6 @@ $whilevar1[1]: length=4 value=|val3|
$whilevar1: not set in global scope $whilevar1: not set in global scope
$whilevar1: not set in universal scope $whilevar1: not set in universal scope
####################
# readonly vars