From 1d6f143c8ae31145dc6cea9d1d67da80fe1b2e5b Mon Sep 17 00:00:00 2001
From: Karl Bartel
Date: Sun, 16 Aug 2026 16:48:06 +0200
Subject: [PATCH] Add test cases for quote pairing and footnote label
normalization
Two edge cases found while checking cdjot against djot.js. Both pass on
main; they pin behaviour that is currently only covered on one side.
smart.test has `''hi''` for doubled quotes as nested, but nothing for a
doubled quote with an empty span. Adjacent delimiters enclose nothing,
so they don't pair and each falls back to its unmatched form -- a right
quote for `'`, a left one for `"`.
footnotes.test covers label normalization on the reference side (a
label spanning lines). The definition side normalizes too, so a wider
gap there still matches the reference; that half was untested.
---
test/footnotes.test | 19 +++++++++++++++++++
test/smart.test | 15 +++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/test/footnotes.test b/test/footnotes.test
index f22a7c3..25bd163 100644
--- a/test/footnotes.test
+++ b/test/footnotes.test
@@ -130,3 +130,22 @@ foo
```
+
+Definition labels are normalized too, so a wider gap in the definition
+still matches the reference:
+
+```
+[^a b]
+
+[^a b]: foo
+.
+1
+
+```
diff --git a/test/smart.test b/test/smart.test
index 4b77226..b7b8695 100644
--- a/test/smart.test
+++ b/test/smart.test
@@ -106,6 +106,21 @@ Doubled quotes are treated as nested:
‘‘hi’’
```
+With nothing between them there is nothing to enclose, so they don't
+pair and each takes its unmatched form:
+
+```
+''
+.
+’’
+```
+
+```
+""
+.
+““
+```
+
Heuristics for determining openers and closers can
be overridden using `{` and `}`: