test: add regression test for pipe inside inline code in renderMd tables

This commit is contained in:
luandnh
2026-06-25 07:04:33 +00:00
committed by nesquena-hermes
parent c1c039ff80
commit dba6340661
+19
View File
@@ -242,6 +242,25 @@ class TestCommonLLMShapes:
assert "<p><table" not in out
assert "</table></p>" not in out
def test_table_pipe_inside_inline_code_is_protected(self, driver_path):
"""Pipes inside backtick code in table cells must not create extra columns."""
src = (
"| field | expr |\n"
"| --- | --- |\n"
"| set | `updates.model = modelState.model || null` |\n"
)
out = _render(driver_path, src)
# Must be exactly 2 cells in the data row
assert "<th>field</th>" in out
assert "<th>expr</th>" in out
# The code cell should contain both pipes
assert "<code>" in out
assert "||" in out
# Must NOT split into extra cells
assert out.count("<td>") == 2, (
f"Expected exactly 2 <td> cells, got {out.count('<td>')}: {out!r}"
)
def test_strikethrough_outside_quote(self, driver_path):
out = _render(driver_path, "This was ~~outdated~~ but is now fine.")
assert "<del>outdated</del>" in out