Bug C: add regression tests for markdown-irc apply-arity
The apply-arity bug from the bug-fix-spike brief (send-message with em-dashes + apostrophes triggering 'apply: too many arguments') was already fixed in v0.1.3 — inline-format's end-of-text path switched from (apply string-append (reverse acc)) to (string-join (reverse acc) ''). Add regression tests pinning the fix:
- The exact trigger text from the brief (Got it via DM. The fix landed — does Goguma's conversations list now show this thread? That's the actual test — message delivery was always working...). - Seven sweep cases combining em-dashes with another non-trivial inline character (ASCII apostrophe, curly single quote, curly double quote, ellipsis, backtick + active markdown, bold + active markdown). - A ~3000-char multi-sentence stress text.
All 12 markdown-irc tests pass.
test/test-markdown-irc.sgl | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)test/test-markdown-irc.sglmodified
(test "code is literal — markers inside aren't parsed" (assert-equal (string-append MONO "*not italic*" MONO) (markdown->irc "`*not italic*`"))));; Regression tests for the apply-arity bug fixed in v0.1.3;; (markdown-irc.sgl now uses `string-join` instead of `apply;; string-append` so multi-sentence prose with em-dashes,;; apostrophes, and other non-ASCII chars survives the inline;; parser without hitting the Sigil-VM apply-arity ceiling).;;;; The trigger text below is the exact string from the;; apiary-bug-fix-spike brief (Bug C). Each sweep case combines;; em-dashes with another non-trivial inline character.(test-group "markdown->irc apply-arity regression (multi-sentence prose)" (define brief-trigger "Got it via DM. The fix landed — does Goguma's conversations list now show this thread? That's the actual test — message delivery was always working...") (test "exact trigger text from bug-fix-spike brief" ;; No markdown markers in the prose, so the output is the ;; input verbatim. The assertion here is that the call ;; *returns* — not what it returns. (assert-equal brief-trigger (markdown->irc brief-trigger))) (test "em-dash sweep" (assert-equal "a — b — c — d — e — f" (markdown->irc "a — b — c — d — e — f"))) (test "em-dash + ASCII apostrophe" (assert-equal "It's working — that's the test — really." (markdown->irc "It's working — that's the test — really."))) (test "em-dash + curly single quote" (assert-equal "It’s working — that’s the test." (markdown->irc "It’s working — that’s the test."))) (test "em-dash + curly double quote" (assert-equal "She said “go” — and “stop” — repeatedly." (markdown->irc "She said “go” — and “stop” — repeatedly."))) (test "em-dash + ellipsis" (assert-equal "Sometimes — when waiting — the loop hangs…" (markdown->irc "Sometimes — when waiting — the loop hangs…"))) (test "em-dash + backtick (markdown active)" (assert-equal (string-append "Run " MONO "build" MONO " — then " MONO "test" MONO " — then ship.") (markdown->irc "Run `build` — then `test` — then ship."))) (test "em-dash + bold (markdown active)" (assert-equal (string-append "Note " BOLD "carefully" BOLD " — and " BOLD "twice" BOLD " — please.") (markdown->irc "Note **carefully** — and **twice** — please."))) (test "very long multi-sentence prose with non-ASCII" ;; Build a string ~3000 chars long that's many sentences with ;; em-dashes and apostrophes — the case that originally ;; tripped the apply ceiling. (let* ((sentence "It's a long sentence — with an em-dash — and apostrophes that test the inline parser's accumulator. ") (long-text (let loop ((acc "") (n 0)) (if (= n 30) acc (loop (string-append acc sentence) (+ n 1)))))) (assert-equal long-text (markdown->irc long-text)))))