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

fix: improve whitelist pattern validation in cleanup tests

This commit is contained in:
tw93
2026-02-03 20:53:21 +08:00
parent 579c963940
commit 0fb4d32bb6

View File

@@ -102,16 +102,17 @@ setup() {
run bash --noprofile --norc -c "cd '$PROJECT_ROOT'; printf \$'\\n' | HOME='$HOME' ./mo clean --whitelist"
[ "$status" -eq 0 ]
grep -q "\\.m2/repository" "$whitelist_file"
first_pattern=$(grep -v '^[[:space:]]*#' "$whitelist_file" | grep -v '^[[:space:]]*$' | head -n 1)
[ -n "$first_pattern" ]
run bash --noprofile --norc -c "cd '$PROJECT_ROOT'; printf \$' \\n' | HOME='$HOME' ./mo clean --whitelist"
[ "$status" -eq 0 ]
run grep -q "\\.m2/repository" "$whitelist_file"
run grep -Fxq "$first_pattern" "$whitelist_file"
[ "$status" -eq 1 ]
run bash --noprofile --norc -c "cd '$PROJECT_ROOT'; printf \$'\\n' | HOME='$HOME' ./mo clean --whitelist"
[ "$status" -eq 0 ]
run grep -q "\\.m2/repository" "$whitelist_file"
run grep -Fxq "$first_pattern" "$whitelist_file"
[ "$status" -eq 1 ]
}