aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-05-29 19:38:43 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-05-29 19:38:43 -0700
commit10e1cc59ba222b463661fe01b0b783a2b8d49112 (patch)
treec903d0c95c61ce785faedd16fe27392e27b50e0e /test
parent271e541893c4d10b3b4fa8f20cb6c54f0af2527e (diff)
downloadtl-who-10e1cc59ba222b463661fe01b0b783a2b8d49112.tar.gz
tl-who-10e1cc59ba222b463661fe01b0b783a2b8d49112.tar.bz2
tl-who-10e1cc59ba222b463661fe01b0b783a2b8d49112.zip
New local macro noesc-fmt; fmt now escapes.
* packages.tl (tl-who): Add noesc-fmt symbol. * who.tl (with-html-output): Add escaping to fmt, which is disabled under *cl-who-compat*. Add noesc-fmt macro that looks like former definition of fmt. * test/simple.tl: New test cases 38-40. * README.md: Mention that TL-WHO provides noesc-fmt.
Diffstat (limited to 'test')
-rw-r--r--test/simple.tl19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/simple.tl b/test/simple.tl
index 7645901..3601814 100644
--- a/test/simple.tl
+++ b/test/simple.tl
@@ -430,3 +430,22 @@
(with-html-output-to-string (out)
(:foo :bar (noesc attr-val)))))
"<foo bar=''blah<tag>'></foo>")
+
+;;; 38
+;;; Test noesc-fmt
+(test (with-html-output-to-string (out)
+ (:foo (noesc-fmt "<a href=\"foo.html\">click</a>")))
+ "<foo><a href=\"foo.html\">click</a></foo>")
+
+;;; 39
+;;; Test that fmt escapes
+(test (with-html-output-to-string (out)
+ (:foo (fmt "<a href=\"foo.html\">click</a>")))
+ "<foo>&lt;a href=\"foo.html\"&gt;click&lt;/a&gt;</foo>")
+
+;;; 40
+;;; Test that fmt doesn't escape under *cl-who-compat*
+(test (expander-let ((*cl-who-compat* t))
+ (with-html-output-to-string (out)
+ (:foo (fmt "<a href=\"foo.html\">click</a>"))))
+ "<foo><a href=\"foo.html\">click</a></foo>")