mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-14 19:27:58 +08:00
parent
a32294620b
commit
c8f4f9dcdb
|
@ -312,7 +312,8 @@ func (cp *compiler) list(n *parse.Array) ValuesOpFunc {
|
|||
func (cp *compiler) errorCapture(n *parse.Chunk) ValuesOpFunc {
|
||||
op := cp.chunkOp(n)
|
||||
return func(ec *EvalCtx) []Value {
|
||||
return []Value{Error{ec.PEval(op)}}
|
||||
op.Exec(ec)
|
||||
return []Value{Bool(ec.predReturn)}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,13 +119,9 @@ var evalTests = []struct {
|
|||
// Output capture
|
||||
{"put (put lorem ipsum)", strs("lorem", "ipsum"), nomore},
|
||||
|
||||
// Status capture
|
||||
{"put ?(true|e:false|e:false)",
|
||||
[]Value{Error{&util.PosError{6, 26, MultiError{[]Error{
|
||||
OK,
|
||||
Error{&util.PosError{11, 18, FakeExternalCmdExit(1, 0)}},
|
||||
Error{&util.PosError{19, 26, FakeExternalCmdExit(1, 0)}},
|
||||
}}}}}, nomore},
|
||||
// Boolean capture
|
||||
{"put ?(true) ?(false)",
|
||||
[]Value{Bool(true), Bool(false)}, nomore},
|
||||
|
||||
// Variable and compounding
|
||||
{"x='SHELL'\nput 'WOW, SUCH '$x', MUCH COOL'\n",
|
||||
|
@ -205,9 +201,11 @@ var evalTests = []struct {
|
|||
}, nomore},
|
||||
{"kind-of bare 'str' [] [&] []{ }",
|
||||
strs("string", "string", "list", "map", "fn"), nomore},
|
||||
{"put ?(fail failed)", []Value{
|
||||
Error{&util.PosError{6, 17, errors.New("failed")}},
|
||||
}, nomore},
|
||||
/*
|
||||
{"put ?(fail failed)", []Value{
|
||||
Error{&util.PosError{6, 17, errors.New("failed")}},
|
||||
}, nomore},
|
||||
*/
|
||||
{`put "l\norem" ipsum | into-lines`, strs(),
|
||||
more{wantBytesOut: []byte("l\norem\nipsum\n")}},
|
||||
{`echo "1\n233" | each put`, strs("1", "233"), nomore},
|
||||
|
|
Loading…
Reference in New Issue
Block a user