Expectation premise output now piped to expectation handler
parent
6dbf996f3b
commit
b4572d420b
4
src/spec
4
src/spec
|
@ -167,7 +167,9 @@ to()
|
|||
type "$assert" &>/dev/null \
|
||||
|| _bail "unknown expectation: \`$type'" $__spec_caller
|
||||
|
||||
$assert "$__spec_rexit" "$@" || fail "$expect_full"
|
||||
$assert "$__spec_rexit" "$@" <<< "$__spec_result" \
|
||||
|| fail "$expect_full"
|
||||
|
||||
__spec_caller=
|
||||
}
|
||||
|
||||
|
|
|
@ -139,6 +139,20 @@ describe expect
|
|||
'; to succeed
|
||||
end
|
||||
|
||||
it pipes command stdout to expectation handler
|
||||
expect test-run <<< '
|
||||
declare str=foo
|
||||
_expect--chk() { test "$(cat)" == "$2"; }
|
||||
|
||||
describe foo
|
||||
it pipes command output
|
||||
expect echo "$str"
|
||||
to chk "$str"
|
||||
end
|
||||
end
|
||||
'; to succeed
|
||||
end
|
||||
|
||||
|
||||
describe to
|
||||
it fails when missing assertion string
|
||||
|
|
Loading…
Reference in New Issue