aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-pearl-convert.el20
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/test-pearl-convert.el b/tests/test-pearl-convert.el
index 1337439..2e278de 100644
--- a/tests/test-pearl-convert.el
+++ b/tests/test-pearl-convert.el
@@ -170,10 +170,10 @@ the conversion-tier docstring) and are excluded here."
(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)."
+keeps a fetch + no-edit push from changing the remote. A URL containing parens
+round-trips despite an imperfect intermediate Org form; inline code whose
+contents look like markdown round-trips because both converters keep code-span
+contents verbatim rather than translating inside them."
(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
@@ -182,5 +182,17 @@ view, but reversed exactly on push)."
"text\n```python\nx = 1\n```\nafter")) ; fence with trailing text
(should (string= md (pearl--org-to-md (pearl--md-to-org md))))))
+(ert-deftest test-pearl-md-line-code-span-verbatim ()
+ "Markdown inside an inline code span renders verbatim, not converted."
+ ;; bold / link / italic inside backticks stay literal in the Org code span
+ (should (string= "~**b**~" (pearl--md-line-to-org "`**b**`")))
+ (should (string= "~[l](u)~" (pearl--md-line-to-org "`[l](u)`")))
+ (should (string= "~_i_~" (pearl--md-line-to-org "`_i_`")))
+ ;; emphasis outside the code span still converts
+ (should (string= "*x* ~**y**~" (pearl--md-line-to-org "**x** `**y**`")))
+ ;; convertible text between two code spans is still converted
+ (should (string= "~**a**~ and [[u][l]]"
+ (pearl--md-line-to-org "`**a**` and [l](u)"))))
+
(provide 'test-pearl-convert)
;;; test-pearl-convert.el ends here