From 0fb4d32bb6a9b2eb058719a1c8774324804fa171 Mon Sep 17 00:00:00 2001 From: tw93 Date: Tue, 3 Feb 2026 20:53:21 +0800 Subject: [PATCH] fix: improve whitelist pattern validation in cleanup tests --- tests/manage_whitelist.bats | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/manage_whitelist.bats b/tests/manage_whitelist.bats index 234f4fb..fdaa659 100644 --- a/tests/manage_whitelist.bats +++ b/tests/manage_whitelist.bats @@ -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 ] }