diff --git a/tests/set.err b/tests/set.err index 39e8350e7..886d00f58 100644 --- a/tests/set.err +++ b/tests/set.err @@ -23,3 +23,7 @@ $argle bargle: invalid var name #################### # if/for/while scope + +#################### +# readonly vars +set: Tried to change the read-only variable 'status' diff --git a/tests/set.in b/tests/set.in index 1db01f32b..12894f963 100644 --- a/tests/set.in +++ b/tests/set.in @@ -70,3 +70,9 @@ function test_ifforwhile_scope set --show ifvar1 ifvar2 ifvar3 whilevar1 end 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 diff --git a/tests/set.out b/tests/set.out index f76de478e..ade050637 100644 --- a/tests/set.out +++ b/tests/set.out @@ -129,3 +129,6 @@ $whilevar1[1]: length=4 value=|val3| $whilevar1: not set in global scope $whilevar1: not set in universal scope + +#################### +# readonly vars