aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-24 15:19:09 -0500
committerCraig Jennings <c@cjennings.net>2026-05-24 15:19:09 -0500
commit95bd7f4661ec5f43ba2eb7e8545b3cf9287e55c8 (patch)
treebf5eb6dc164ccfdca294aecba61b72a5c951244b /tests
parent0a65ae7c57aecbb948a3cf9675564b731efee55d (diff)
downloadpearl-95bd7f4661ec5f43ba2eb7e8545b3cf9287e55c8.tar.gz
pearl-95bd7f4661ec5f43ba2eb7e8545b3cf9287e55c8.zip
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-pearl-convert.el14
1 files changed, 14 insertions, 0 deletions
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