Skip to content

Commit 5a3eb25

Browse files
zkoppertCopilot
andcommitted
Tighten MediaWiki ESCAPED_TAGS test to assert idempotency
The previous assertion only checked that 'tt' was present in ESCAPED_TAGS after two renders, which would still pass if the idempotency guard regressed and appended duplicates. Switch to counting 'tt' occurrences so the test would fail if WikiCloth's ESCAPED_TAGS<<'tt' ever ran twice. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Zack Koppert <zkoppert@github.com>
1 parent 2a07090 commit 5a3eb25

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

test/coverage_test.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,11 @@ def test_mediawiki_render_is_idempotent_for_escaped_tags
185185
body = "==Hello==\nworld"
186186
# First render adds 'tt'; second render hits the `else` branch of `unless include?('tt')`.
187187
GitHub::Markup.render("README.mediawiki", body)
188+
count_after_first = WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.count('tt')
188189
GitHub::Markup.render("README.mediawiki", body)
189-
assert_includes WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS, 'tt'
190+
count_after_second = WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.count('tt')
191+
assert_equal 1, count_after_first, "first render should leave exactly one 'tt' entry"
192+
assert_equal 1, count_after_second, "second render must not append a duplicate 'tt'"
190193
end
191194

192195
# --- command_implementation.rb block arity branches --------------------

0 commit comments

Comments
 (0)