aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-09-30 17:06:56 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-09-30 17:06:56 -0700
commit51527612d3162fde31c41d7183320365856f2aae (patch)
treef1d1703cc516d3a5d34e4f75d4547d70c7ac8e55 /tests
parentc181de1d7fa46821c7a89633e3ab3639d89fd2a3 (diff)
Don't leave is_block in bad state after bad redirection
Fixes #1728.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/gen_output.fish4
-rw-r--r--tests/status.err2
-rw-r--r--tests/status.in9
-rw-r--r--tests/status.out0
-rw-r--r--tests/status.status1
-rw-r--r--tests/top.out1
6 files changed, 15 insertions, 2 deletions
diff --git a/tests/gen_output.fish b/tests/gen_output.fish
index 49e15bfd..7bf7f3ec 100755
--- a/tests/gen_output.fish
+++ b/tests/gen_output.fish
@@ -1,4 +1,4 @@
-#!/usr/bin/fish
+#!/usr/bin/env fish
#
# Generate output for a test script
@@ -14,4 +14,4 @@ for i in $argv
fish <$i >$template_out ^$template_err
echo $status >$template_status
-end \ No newline at end of file
+end
diff --git a/tests/status.err b/tests/status.err
new file mode 100644
index 00000000..91645c95
--- /dev/null
+++ b/tests/status.err
@@ -0,0 +1,2 @@
+fish: An error occurred while redirecting file '/'
+open: Is a directory
diff --git a/tests/status.in b/tests/status.in
new file mode 100644
index 00000000..14dff232
--- /dev/null
+++ b/tests/status.in
@@ -0,0 +1,9 @@
+# vim: set filetype=fish:
+
+# 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'
+
+true
diff --git a/tests/status.out b/tests/status.out
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/status.out
diff --git a/tests/status.status b/tests/status.status
new file mode 100644
index 00000000..573541ac
--- /dev/null
+++ b/tests/status.status
@@ -0,0 +1 @@
+0
diff --git a/tests/top.out b/tests/top.out
index a62ec047..87d1ee31 100644
--- a/tests/top.out
+++ b/tests/top.out
@@ -2,6 +2,7 @@ Testing high level script functionality
File expansion.in tested ok
File printf.in tested ok
File read.in tested ok
+File status.in tested ok
File test1.in tested ok
File test2.in tested ok
File test3.in tested ok