mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-04 10:57:50 +08:00
Fix failing tests.
This commit is contained in:
parent
f77fd16a6c
commit
ff6a2d025a
|
@ -117,9 +117,16 @@ func NewExternalCmdExit(ws syscall.WaitStatus, pid int) error {
|
|||
if ws.Exited() && ws.ExitStatus() == 0 {
|
||||
return nil
|
||||
}
|
||||
if !ws.Stopped() {
|
||||
pid = 0
|
||||
}
|
||||
return ExternalCmdExit{ws, pid}
|
||||
}
|
||||
|
||||
func FakeExternalCmdExit(exit int, sig syscall.Signal) ExternalCmdExit {
|
||||
return ExternalCmdExit{syscall.WaitStatus(exit<<8 + int(sig)), 0}
|
||||
}
|
||||
|
||||
func (exit ExternalCmdExit) Error() string {
|
||||
ws := exit.WaitStatus
|
||||
switch {
|
||||
|
|
|
@ -40,7 +40,8 @@ var evalTests = []struct {
|
|||
// Outputs of pipelines in a chunk are concatenated
|
||||
{"put x; put y; put z", strs("x", "y", "z"), nomore},
|
||||
// A failed pipeline cause the whole chunk to fail
|
||||
{"put a; false; put b", strs("a"), more{wantError: errors.New("1")}},
|
||||
{"put a; false; put b", strs("a"), more{
|
||||
wantError: FakeExternalCmdExit(1, 0)}},
|
||||
|
||||
// Pipelines.
|
||||
// Pure byte pipeline
|
||||
|
@ -104,8 +105,11 @@ var evalTests = []struct {
|
|||
|
||||
// Status capture
|
||||
{"put ?(true|false|false)",
|
||||
[]Value{newMultiError(OK, Error{errors.New("1")},
|
||||
Error{errors.New("1")})}, nomore},
|
||||
[]Value{newMultiError(
|
||||
OK,
|
||||
Error{FakeExternalCmdExit(1, 0)},
|
||||
Error{FakeExternalCmdExit(1, 0)},
|
||||
)}, nomore},
|
||||
|
||||
// Variable and compounding
|
||||
{"x='SHELL'\nput 'WOW, SUCH '$x', MUCH COOL'\n",
|
||||
|
|
Loading…
Reference in New Issue
Block a user