Skip to content

Commit 402162b

Browse files
ZviBaratzclaude
andcommitted
test(ego-lint): add count-based assertion for prototype-override dedup
The existing assertions only checked presence of warnings via grep -qE, which would pass whether dedup produced 2 or 4 warnings. Add assert_output_count helper and use it to verify exactly 2 warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 883cfe4 commit 402162b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/assertions/proto-override-dedup.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ echo "=== proto-override-dedup ==="
55
run_lint "proto-override-dedup@test"
66
assert_output_contains "prototype override detected" "\[WARN\].*lifecycle/prototype-override.*BackgroundMenu.prototype.open"
77
assert_output_contains "search prototype override detected" "\[WARN\].*lifecycle/prototype-override.*SearchController.prototype.startSearch"
8+
assert_output_count "exactly 2 prototype-override warnings (dedup works)" "\[WARN\].*lifecycle/prototype-override" 2
89
echo ""

tests/run-tests.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ assert_exit_code() {
4545
fi
4646
}
4747

48+
assert_output_count() {
49+
local label="$1" pattern="$2" expected="$3"
50+
local actual
51+
actual=$(echo "$output" | grep -cE "$pattern" || true)
52+
if [[ "$actual" -eq "$expected" ]]; then
53+
echo -e " ${GREEN}${NC} $label (count: $actual)"
54+
PASS_COUNT=$((PASS_COUNT + 1))
55+
else
56+
echo -e " ${RED}${NC} $label (expected $expected matches, got $actual)"
57+
FAIL_COUNT=$((FAIL_COUNT + 1))
58+
fi
59+
}
60+
4861
run_lint() {
4962
local fixture="$1"
5063
output=""

0 commit comments

Comments
 (0)