wgctl/core/framework/test/test.sh
Nuno Duque Nunes 290ac24d88 refactor: core directory restructure
- 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
2026-05-30 02:50:43 +00:00

46 lines
No EOL
977 B
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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 ]]
}