Fixing bug in try

This commit is contained in:
Sławomir Śledź 2018-03-10 23:23:23 +01:00
parent 6de7798c8a
commit c3425e0933
2 changed files with 4 additions and 2 deletions

View file

@ -4,6 +4,8 @@ testTry() {
assertEquals 1 "$(echo 'expr 2 / 2' | try lambda _ . 'ret 0')"
assertEquals 0 "$(echo 'expr 2 / 0' | try lambda _ . 'ret 0')"
assertEquals 2 "$(echo 'expr 2 / 0' | try lambda status . 'ret $status')"
assertEquals 'already up to date' "$(echo 'echo already up to date' | try lambda _ . 'ret error')"
assertEquals 'error exit 1' "$(try λ _ . 'echo "error"; echo exit 1' < <(echo fgit pull) | unlist)"
}
. ./shunit2-init.sh