From 95bd7f4661ec5f43ba2eb7e8545b3cf9287e55c8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 24 May 2026 15:19:09 -0500 Subject: test: lock markdown round-trip identity across boundary cases Added a round-trip test for the markdown boundary cases the coverage audit flagged: multiple links on a line, parens inside a URL, inline code whose contents look like markdown, non-ASCII prose, and unclosed / trailing fenced code. All round-trip to identity, so a fetch with no edit cannot change the remote on push. Two cases (paren-URL and markdown-looking inline code) round-trip safely despite an imperfect intermediate Org form, noted in the test and filed as a display-fidelity follow-up. 376 tests green. --- tests/test-pearl-convert.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/test-pearl-convert.el b/tests/test-pearl-convert.el index 4125e22..1337439 100644 --- a/tests/test-pearl-convert.el +++ b/tests/test-pearl-convert.el @@ -168,5 +168,19 @@ the conversion-tier docstring) and are excluded here." "| a | b |\n|---|---|")) (should (string= md (pearl--org-to-md (pearl--md-to-org md)))))) +(ert-deftest test-pearl-convert-roundtrip-boundary-cases () + "Round-trip identity holds across markdown boundary cases — the property that +keeps a fetch + no-edit push from changing the remote. Two of these round-trip +safely despite an imperfect intermediate Org form: a URL containing parens, and +inline code whose contents look like markdown (rendered converted in the Org +view, but reversed exactly on push)." + (dolist (md '("[a](u1) and [b](u2)" ; multiple links on a line + "see [docs](http://x.com/(p))" ; parens inside the URL + "`**b** and [l](u) and _i_`" ; markdown-looking inline code + "café — naïve 日本語 ✓" ; non-ASCII prose + "before\n```\nunclosed code\nmore code" ; unclosed fence, no swallow + "text\n```python\nx = 1\n```\nafter")) ; fence with trailing text + (should (string= md (pearl--org-to-md (pearl--md-to-org md)))))) + (provide 'test-pearl-convert) ;;; test-pearl-convert.el ends here -- cgit v1.2.3