Support ✓/✗ as alternatives to [success]/[failure]

This commit is contained in:
Sven van Heugten 2026-04-16 17:01:40 +02:00
parent 4704cc088d
commit 0719fa33c2
No known key found for this signature in database
GPG key ID: D612F88666F4F660
3 changed files with 49 additions and 21 deletions

View file

@ -368,6 +368,34 @@ commit_with_assertion() {
assert_output --partial "Expected command to fail, but it succeeded."
}
@test "a ✓ command should succeed if the executed command succeeded" {
git checkout -b feature
commit_with_assertion '✓ exit 0'
run git-check-assertions
assert_success
}
@test "a ✗ command should succeed if the executed command failed" {
git checkout -b feature
commit_with_assertion '✗ exit 1'
run git-check-assertions
assert_success
}
@test "you can mix symbols and bracketed asserts in the same block" {
git checkout -b feature
commit_with_assertion $'✓ echo hello\nhello\n[failure] exit 0'
run git-check-assertions
assert_failure
assert_output --partial "Expected command to fail, but it succeeded."
}
@test "an output line should succeed if the output contains the given string" {
git checkout -b feature
commit_with_assertion $'[success] echo hello\nhello'