Skip to content
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, " ]]
}