(in-package :panettone.tests)
(declaim (optimize (safety 3)))
(defmacro inline-markdown-unit-test (name input expected)
`(test ,name
(is (equal
,expected
(with-output-to-string (*standard-output*)
(render-inline-markdown ,input))))))
(inline-markdown-unit-test
inline-markdown-typical-test
"hello _world_, here is ~~no~~ `code`!"
"hello world, here is no code
!")
(inline-markdown-unit-test
inline-markdown-two-emphasize-types-test
"_stress_ *this*"
"stress this")
(inline-markdown-unit-test
inline-markdown-html-escaping-test
"âÀü"
"<tag>öäü")
(inline-markdown-unit-test
inline-markdown-nesting-test
"`inside code *anything* goes`, but also ~~*here*~~"
"inside code *anything* goes
, but also *here*")
(inline-markdown-unit-test
inline-markdown-escaping-test
"A backslash \\\\ shows: \\*, \\_, \\` and \\~~"
"A backslash \\ shows: *, _, ` and ~~")
(inline-markdown-unit-test
inline-markdown-nested-escaping-test
"`prevent \\`code\\` from ending, but never stand alone \\\\`"
"prevent `code` from ending, but never stand alone \\
")
(inline-markdown-unit-test
inline-markdown-escape-normal-tokens-test
"\\Normal tokens \\escaped?"
"\\Normal tokens \\escaped?")
(inline-markdown-unit-test
inline-markdown-no-unclosed-tags-test
"A tag, once opened, _must be closed"
"A tag, once opened, must be closed")
(inline-markdown-unit-test
inline-markdown-unicode-safe
"Does Unicode π¨βπ¨βπ§βπ¦ break \\π©πΎβπ¦° tokenization?"
"Does Unicode 👨👨👧👦 break \\👩🏾🦰 tokenization?")