Skip to content
Merged
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
14 changes: 7 additions & 7 deletions docs/common-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function tear_down_after_script() {
}

function test_server_responds_to_ping() {
assert_successful_code "curl -s http://localhost:8080/ping"
assert_exec "curl -s http://localhost:8080/ping"
}

function test_server_returns_json() {
Expand Down Expand Up @@ -426,7 +426,7 @@ function test_script_fails_on_error() {

function test_error_handled_gracefully() {
# Script should catch and handle expected errors
assert_successful_code "./src/resilient_script.sh"
assert_exec "./src/resilient_script.sh"
}
```
:::
Expand Down Expand Up @@ -539,7 +539,7 @@ function test_json_is_valid() {
output=$(./src/generate_report.sh --format json)

# Use jq to validate JSON (mock it if jq not available)
assert_successful_code "echo '$output' | jq . > /dev/null"
assert_exec "echo '$output' | jq . > /dev/null"
}
```
:::
Expand Down Expand Up @@ -769,11 +769,11 @@ function set_up() {

# Test private function directly after sourcing
function test_private_validate_input_accepts_numbers() {
assert_successful_code "_validate_input 123"
assert_exec "_validate_input 123"
}

function test_private_validate_input_rejects_text() {
assert_general_error "_validate_input abc"
assert_exec "_validate_input abc" --exit 1
}

# Test through public interface
Expand Down Expand Up @@ -809,7 +809,7 @@ function data_provider_valid_emails() {
}

function test_valid_email_formats() {
assert_successful_code "validate_email '$1'"
assert_exec "validate_email '$1'"
}

function data_provider_invalid_emails() {
Expand All @@ -820,7 +820,7 @@ function data_provider_invalid_emails() {
}

function test_invalid_email_formats() {
assert_general_error "validate_email '$1'"
assert_exec "validate_email '$1'" --exit 1
}
```
:::
Expand Down
Loading