aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-09-30 20:58:45 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-09-30 20:58:45 -0700
commit3616dd588949b3c8f5d238c315b43b65439bf119 (patch)
tree7b9e6ab0f0fc3a3a29f66f49744e2a1c8fbdfcc7 /tests
parent489fb7ec3f13e21d0dd157c0d589e07dfb6ee271 (diff)
Base `status -b` off the parser execution stack
Instead of globally marking the state as "in block" when evaluating blocks/functions, update the "in block" status when pushing/popping blocks on the parser stack. Fixes #1729. On a side note, `status -b` is actually pretty useless, because it always returns 0 inside of a function (even without this patch).
Diffstat (limited to 'tests')
-rw-r--r--tests/status.in10
-rw-r--r--tests/status.out2
2 files changed, 11 insertions, 1 deletions
diff --git a/tests/status.in b/tests/status.in
index 14dff232..875f62f3 100644
--- a/tests/status.in
+++ b/tests/status.in
@@ -1,9 +1,17 @@
# vim: set filetype=fish:
+status -b
+or echo 'top level'
+
+begin
+ status -b
+end
+and echo 'block'
+
# Issue #1728
# Bad file redirection on a block causes `status --is-block` to return 0 forever.
begin; end >/ # / is a directory, it can't be opened for writing
status -b
-and echo 'block'
+and echo 'unexpected block'
true
diff --git a/tests/status.out b/tests/status.out
index e69de29b..a6546ffd 100644
--- a/tests/status.out
+++ b/tests/status.out
@@ -0,0 +1,2 @@
+top level
+block