Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "&&" to ensure "status" is included in test pass/fail #445

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions exercises/error-handling/error_handling_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,38 @@
#[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh Alice

(( status == 0 ))
(( status == 0 )) &&
[[ $output == "Hello, Alice" ]]
}

@test "one long argument" {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh "Alice and Bob"

(( status == 0 ))
(( status == 0 )) &&
[[ $output == "Hello, Alice and Bob" ]]
}

@test "incorrect arguments" {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh Alice Bob

(( status == 1 ))
(( status == 1 )) &&
[[ $output == "Usage: error_handling.sh <person>" ]]
}

@test "print usage banner with no value given" {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh

(( status == 1 ))
(( status == 1 )) &&
[[ $output == "Usage: error_handling.sh <person>" ]]
}

@test "empty argument" {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh ""

(( status == 0 ))
(( status == 0 )) &&
[[ $output == "Hello, " ]]
}