# shellcheck shell=bash

step() {
  printf '\n[STEP] %s\n' "$1"
}

pass() {
  printf '[PASS] %s\n' "$1"
}

fail() {
  printf '[FAIL] %s\n' "$1" >&2
  exit 1
}

on_error() {
  fail "Unexpected error at line $1"
}

require_file() {
  local target_path="$1"

  if [[ ! -f "$target_path" ]]; then
    fail "Expected file not found: $target_path"
  fi
}

assert_contains() {
  local target_path="$1"
  local expected_text="$2"

  if ! grep -F -- "$expected_text" "$target_path" >/dev/null 2>&1; then
    fail "Expected to find [$expected_text] in $target_path"
  fi
}
