Expectation premise output now piped to expectation handler

stderr
Mike Gerwitz 2014-05-09 01:59:21 -04:00
parent 6dbf996f3b
commit b4572d420b
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
2 changed files with 17 additions and 1 deletions

View File

@ -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=
}

View File

@ -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