Initial commit

This commit is contained in:
2023-04-18 21:30:43 +02:00
commit 8a54eb45e8
32 changed files with 3636 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env bats
load bats-extra
# local version: 0.0.1
@test "correct arguments" {
#[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh Alice
assert_success
assert_output "Hello, Alice"
}
@test "one long argument" {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh "Alice and Bob"
assert_success
assert_output "Hello, Alice and Bob"
}
@test "incorrect arguments" {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh Alice Bob
assert_failure
assert_output "Usage: error_handling.sh <person>"
}
@test "print usage banner with no value given" {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh
assert_failure
assert_output "Usage: error_handling.sh <person>"
}
@test "empty argument" {
[[ $BATS_RUN_SKIPPED == "true" ]] || skip
run bash error_handling.sh ""
assert_success
assert_output "Hello, "
}