1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-09 09:04:16 +00:00

feat: optimize clean operation performance by pre-expanding whitelist patterns, improving size calculation, and adapting parallel processing based on file types, alongside test suite enhancements.

This commit is contained in:
Tw93
2025-12-30 17:13:43 +08:00
parent 41ce597f02
commit 6c1fcd23d7
6 changed files with 207 additions and 86 deletions

View File

@@ -28,7 +28,7 @@ setup() {
}
@test "mo clean --dry-run skips system cleanup in non-interactive mode" {
run env HOME="$HOME" "$PROJECT_ROOT/mole" clean --dry-run
run env HOME="$HOME" MOLE_TEST_MODE=1 "$PROJECT_ROOT/mole" clean --dry-run
[ "$status" -eq 0 ]
[[ "$output" == *"Dry Run Mode"* ]]
[[ "$output" != *"Deep system-level cleanup"* ]]
@@ -38,7 +38,7 @@ setup() {
mkdir -p "$HOME/Library/Caches/TestApp"
echo "cache data" > "$HOME/Library/Caches/TestApp/cache.tmp"
run env HOME="$HOME" "$PROJECT_ROOT/mole" clean --dry-run
run env HOME="$HOME" MOLE_TEST_MODE=1 "$PROJECT_ROOT/mole" clean --dry-run
[ "$status" -eq 0 ]
[[ "$output" == *"User app cache"* ]]
[[ "$output" == *"Potential space"* ]]
@@ -53,7 +53,7 @@ setup() {
$HOME/Library/Caches/WhitelistedApp*
EOF
run env HOME="$HOME" "$PROJECT_ROOT/mole" clean --dry-run
run env HOME="$HOME" MOLE_TEST_MODE=1 "$PROJECT_ROOT/mole" clean --dry-run
[ "$status" -eq 0 ]
[[ "$output" == *"Protected"* ]]
[ -f "$HOME/Library/Caches/WhitelistedApp/data.tmp" ]
@@ -63,7 +63,7 @@ EOF
mkdir -p "$HOME/.m2/repository/org/example"
echo "dependency" > "$HOME/.m2/repository/org/example/lib.jar"
run env HOME="$HOME" "$PROJECT_ROOT/mole" clean --dry-run
run env HOME="$HOME" MOLE_TEST_MODE=1 "$PROJECT_ROOT/mole" clean --dry-run
[ "$status" -eq 0 ]
[ -f "$HOME/.m2/repository/org/example/lib.jar" ]
[[ "$output" != *"Maven repository cache"* ]]