Introduce assert_output
This commit is contained in:
parent
f9d6696687
commit
b57d527d6e
2 changed files with 29 additions and 2 deletions
|
|
@ -150,3 +150,23 @@ commit_with_assertion() {
|
|||
assert_failure
|
||||
assert_output --partial "Expected command to fail, but it succeeded."
|
||||
}
|
||||
|
||||
@test "assert_output should succeed if the output matches the given string" {
|
||||
git checkout -b feature
|
||||
commit_with_assertion $'run echo hello\nassert_output hello'
|
||||
|
||||
run git-check-assertions
|
||||
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "assert_output should fail if the output does not match the given string" {
|
||||
git checkout -b feature
|
||||
commit_with_assertion $'run echo hello\nassert_output goodbye'
|
||||
|
||||
run git-check-assertions
|
||||
|
||||
assert_failure
|
||||
assert_output --partial "Expected output to equal: goodbye"
|
||||
assert_output --partial "Actual output: hello"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue