Commit0a08f612Recorded5 May 2026Repositoryapiary

Bug C: add regression tests for markdown-irc apply-arity

Message

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.

Changed
 test/test-markdown-irc.sgl | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
Diff
test/test-markdown-irc.sglmodified
@@ -94,3 +94,62 @@
94
(test "code is literal — markers inside aren't parsed"
95
(assert-equal (string-append MONO "*not italic*" MONO)
96
(markdown->irc "`*not italic*`"))))
+97
+98
;; Regression tests for the apply-arity bug fixed in v0.1.3
+99
;; (markdown-irc.sgl now uses `string-join` instead of `apply
+100
;; string-append` so multi-sentence prose with em-dashes,
+101
;; apostrophes, and other non-ASCII chars survives the inline
+102
;; parser without hitting the Sigil-VM apply-arity ceiling).
+103
;;
+104
;; The trigger text below is the exact string from the
+105
;; apiary-bug-fix-spike brief (Bug C). Each sweep case combines
+106
;; em-dashes with another non-trivial inline character.
+107
(test-group "markdown->irc apply-arity regression (multi-sentence prose)"
+108
(define brief-trigger
+109
"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...")
+110
+111
(test "exact trigger text from bug-fix-spike brief"
+112
;; No markdown markers in the prose, so the output is the
+113
;; input verbatim. The assertion here is that the call
+114
;; *returns* — not what it returns.
+115
(assert-equal brief-trigger
+116
(markdown->irc brief-trigger)))
+117
+118
(test "em-dash sweep"
+119
(assert-equal "a — b — c — d — e — f"
+120
(markdown->irc "a — b — c — d — e — f")))
+121
+122
(test "em-dash + ASCII apostrophe"
+123
(assert-equal "It's working — that's the test — really."
+124
(markdown->irc "It's working — that's the test — really.")))
+125
+126
(test "em-dash + curly single quote"
+127
(assert-equal "It’s working — that’s the test."
+128
(markdown->irc "It’s working — that’s the test.")))
+129
+130
(test "em-dash + curly double quote"
+131
(assert-equal "She said “go” — and “stop” — repeatedly."
+132
(markdown->irc "She said “go” — and “stop” — repeatedly.")))
+133
+134
(test "em-dash + ellipsis"
+135
(assert-equal "Sometimes — when waiting — the loop hangs…"
+136
(markdown->irc "Sometimes — when waiting — the loop hangs…")))
+137
+138
(test "em-dash + backtick (markdown active)"
+139
(assert-equal (string-append "Run " MONO "build" MONO " — then " MONO "test" MONO " — then ship.")
+140
(markdown->irc "Run `build` — then `test` — then ship.")))
+141
+142
(test "em-dash + bold (markdown active)"
+143
(assert-equal (string-append "Note " BOLD "carefully" BOLD " — and " BOLD "twice" BOLD " — please.")
+144
(markdown->irc "Note **carefully** — and **twice** — please.")))
+145
+146
(test "very long multi-sentence prose with non-ASCII"
+147
;; Build a string ~3000 chars long that's many sentences with
+148
;; em-dashes and apostrophes — the case that originally
+149
;; tripped the apply ceiling.
+150
(let* ((sentence "It's a long sentence — with an em-dash — and apostrophes that test the inline parser's accumulator. ")
+151
(long-text
+152
(let loop ((acc "") (n 0))
+153
(if (= n 30) acc
+154
(loop (string-append acc sentence) (+ n 1))))))
+155
(assert-equal long-text (markdown->irc long-text)))))