tests: Move directory redirection test to invocation

This tested #1728, where redirecting a directory (`begin; something;
end < .`) would cause `status` to misbehave.

Unfortunately, on Illumos/OpenIndiana/SunOS, this returns a different
error (EINVAL instead of EISDIR), so we can't check that with our test harness, because
we can't redirect it.

Since it's not important that this gives the same error across
systems (and indeed we provide no way of intercepting the error!),
use an invocation test instead, because that allows different output per-uname.

See #5472.
This commit is contained in:
Fabian Homborg 2019-01-18 22:50:38 +01:00
parent ca5b7c0ec4
commit c62d95e428
5 changed files with 7 additions and 8 deletions

View File

@ -0,0 +1,3 @@
<W> fish: An error occurred while redirecting file '.'
open: Is a directory
RC: 1

View File

@ -0,0 +1,3 @@
<W> fish: An error occurred while redirecting file '.'
open: Invalid argument
RC: 1

View File

@ -0,0 +1 @@
-c 'begin; end > . ; status -b; and echo "status -b returned true after bad redirect on a begin block"'

View File

@ -1,5 +1,3 @@
<W> fish: An error occurred while redirecting file '.'
open: Is a directory
status: Invalid combination of options,
you cannot do both 'is-interactive' and 'is-login' in the same invocation
status: Invalid combination of options,

View File

@ -8,12 +8,6 @@ begin
or echo '"status -b" unexpectedly returned false inside a begin block'
end
# 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 '"status -b" unexpectedly returned true after bad redirect on a begin block'
status -l
and echo '"status -l" unexpectedly returned true for a non-login shell'