From 067a359e42bb8179e4c7ec67dbfc1dca55194d93 Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Fri, 6 Jan 2017 16:18:44 -0600 Subject: [PATCH] Add acceptance tests for improved exit values (#35) --- test/103_accept_git.bats | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/test/103_accept_git.bats b/test/103_accept_git.bats index 6808b9e..61a5a45 100644 --- a/test/103_accept_git.bats +++ b/test/103_accept_git.bats @@ -13,7 +13,7 @@ function setup_environment() { echo " When the command 'bogus' is provided Report bogus is not a command - Exit with 0 + Exit with 1 " #; start fresh @@ -23,10 +23,31 @@ function setup_environment() { run "${T_YADM_Y[@]}" bogus #; validate status and output - [ "$status" -eq 0 ] + [ "$status" -eq 1 ] [[ "$output" =~ .bogus..is.not.a.git.command ]] } +@test "Git command 'add' - badfile" { + echo " + When the command 'add' is provided + And the file specified does not exist + Exit with 128 + " + + #; start fresh + setup_environment + + #; define a non existig testfile + local testfile="$T_DIR_WORK/does_not_exist" + + #; run add + run "${T_YADM_Y[@]}" add -v "$testfile" + + #; validate status and output + [ "$status" -eq 128 ] + [[ "$output" =~ pathspec.+did.not.match ]] +} + @test "Git command 'add'" { echo " When the command 'add' is provided