aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-10-23 15:15:39 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-10-23 15:15:39 -0700
commitd5f3a09ce932779346d521afe1ba0ffdcb1cbfa9 (patch)
tree6ba863d5eba6c7b02e505e3d7b30ec21a13f88db /tests
parent036a29acf5d5184a4850475a1ae2f9512058744a (diff)
Make 'set -ql' search up to function scope
Previously 'set -ql' would only look for variables in the immediate local scope. This was not very useful. It's also arguably surprising, since a 'set -l' in a function, followed by a 'set -ql' in a child block, would fail. There was also no way to check for a function-scoped variable, since omitting the scope would also pull in global variables. We could revisit this and introduce an explicit function scope. Fixes #2502
Diffstat (limited to 'tests')
-rw-r--r--tests/test4.in11
-rw-r--r--tests/test4.out2
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/test4.in b/tests/test4.in
index f207e6b7..6d501455 100644
--- a/tests/test4.in
+++ b/tests/test4.in
@@ -177,3 +177,14 @@ true ; set -NOT_AN_OPTION 2> /dev/null ; echo 9 $status # no passthrough
false ; set foo (echo A; true) ; echo 10 $status $foo
true ; set foo (echo B; false) ; echo 11 $status $foo
true
+
+echo "Verify set -ql behavior" # see 2502
+function setql_check
+ set -l setql_foo val
+ if set -ql setql_foo
+ echo Pass
+ else
+ echo Fail
+ end
+end
+setql_check
diff --git a/tests/test4.out b/tests/test4.out
index 148d870c..f38fa96f 100644
--- a/tests/test4.out
+++ b/tests/test4.out
@@ -34,3 +34,5 @@ Verify that set passes through exit status, except when passed -n or -q or -e
9 1
10 0 A
11 1 B
+Verify set -ql behavior
+Pass