- core/framework/: flag.sh, hook.sh, help.sh, command.sh, mixin.sh - core/app/: wgctl-specific context.sh, json.sh - core/framework/mixins/: json_output, no_color mixins - core/core.sh: sources framework/core.sh + app/core.sh - PYTHONPATH exported in app/core.sh for lib/ module resolution - command::_load_mixins: uses _FRAMEWORK_DIR for mixin path
46 lines
No EOL
977 B
Bash
46 lines
No EOL
977 B
Bash
#!/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 ]]
|
||
} |