#!/usr/bin/env bash # ============================================ # Test Framework # ============================================ TEST_PASS=0 TEST_FAIL=0 TEST_WARN=0 function test::pass() { local desc="$1" printf " \033[1;32m✅\033[0m %s\n" "$desc" (( TEST_PASS++ )) || true } function test::fail() { local desc="$1" printf " \033[1;31m❌\033[0m %s\n" "$desc" (( TEST_FAIL++ )) || true } function test::warn() { local desc="$1" printf " \033[1;33m⚠️ \033[0m %s\n" "$desc" (( TEST_WARN++ )) || true } function test::section() { printf "\n \033[1;37m%s\033[0m\n" "$1" printf " %s\n" "$(printf '─%.0s' {1..50})" } function test::reset() { TEST_PASS=0 TEST_FAIL=0 TEST_WARN=0 } function test::summary() { printf "\n" printf " \033[1;32m✅ %s passed\033[0m " "$TEST_PASS" printf "\033[1;31m❌ %s failed\033[0m " "$TEST_FAIL" printf "\033[1;33m⚠️ %s warnings\033[0m\n\n" "$TEST_WARN" [[ "$TEST_FAIL" -eq 0 ]] }