mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 12:15:08 +00:00
fix: Add Library directory existence check to clean script and enhance test script for bats version compatibility.
This commit is contained in:
@@ -18,6 +18,10 @@ clean_user_essentials() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean_empty_library_items() {
|
clean_empty_library_items() {
|
||||||
|
if [[ ! -d "$HOME/Library" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
local -a empty_dirs=()
|
local -a empty_dirs=()
|
||||||
while IFS= read -r -d '' dir; do
|
while IFS= read -r -d '' dir; do
|
||||||
[[ -d "$dir" ]] && empty_dirs+=("$dir")
|
[[ -d "$dir" ]] && empty_dirs+=("$dir")
|
||||||
|
|||||||
@@ -49,11 +49,20 @@ if command -v bats > /dev/null 2>&1 && [ -d "tests" ]; then
|
|||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
set -- tests
|
set -- tests
|
||||||
fi
|
fi
|
||||||
if TERM="${TERM:-xterm-256color}" bats --formatter "${BATS_FORMATTER:-pretty}" "$@"; then
|
if bats --help 2>&1 | grep -q -- "--formatter"; then
|
||||||
printf "${GREEN}${ICON_SUCCESS} Unit tests passed${NC}\n"
|
if TERM="${TERM:-xterm-256color}" bats --formatter "${BATS_FORMATTER:-pretty}" "$@"; then
|
||||||
|
printf "${GREEN}${ICON_SUCCESS} Unit tests passed${NC}\n"
|
||||||
|
else
|
||||||
|
printf "${RED}${ICON_ERROR} Unit tests failed${NC}\n"
|
||||||
|
((FAILED++))
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
printf "${RED}${ICON_ERROR} Unit tests failed${NC}\n"
|
if TERM="${TERM:-xterm-256color}" bats --tap "$@" | sed -e 's/^ok /OK /' -e 's/^not ok /FAIL /'; then
|
||||||
((FAILED++))
|
printf "${GREEN}${ICON_SUCCESS} Unit tests passed${NC}\n"
|
||||||
|
else
|
||||||
|
printf "${RED}${ICON_ERROR} Unit tests failed${NC}\n"
|
||||||
|
((FAILED++))
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf "${YELLOW}${ICON_WARNING} bats not installed or no tests found, skipping${NC}\n"
|
printf "${YELLOW}${ICON_WARNING} bats not installed or no tests found, skipping${NC}\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user