Introduce assert_success
This commit is contained in:
parent
a1ffb1abd4
commit
1a10b24b06
2 changed files with 36 additions and 0 deletions
|
|
@ -32,6 +32,23 @@ assert_fails() {
|
|||
}
|
||||
export -f assert_fails
|
||||
|
||||
# helper functions inspired by bats/bats-assert
|
||||
run() {
|
||||
set +e
|
||||
("$@")
|
||||
status=$?
|
||||
set -e
|
||||
return 0
|
||||
}
|
||||
assert_success() {
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo "Expected command to succeed, but it failed."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
export -f run assert_success
|
||||
|
||||
# main flow
|
||||
orig_ref="$(git symbolic-ref --quiet --short HEAD || git rev-parse HEAD)"
|
||||
base="$(git merge-base main HEAD)"
|
||||
mapfile -t commits < <(git rev-list --reverse "${base}..HEAD")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue