aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-18 12:52:53 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-18 12:52:53 -0400
commit04603308af3a2984d42eaa9e301cac0ffbded2a4 (patch)
tree1a8ba81eb6d9b8409428bd3cb830d6c07177eafe /test
parentda4d07c6658f6b8189f98dfb051a7299fe45fb62 (diff)
Tweak test code
Diffstat (limited to 'test')
-rw-r--r--test/lang.tm11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/lang.tm b/test/lang.tm
index 3dea6ded..01551e27 100644
--- a/test/lang.tm
+++ b/test/lang.tm
@@ -1,5 +1,5 @@
lang HTML:
- HEADER := $HTML{}"<!DOCTYPE HTML>"
+ HEADER := $HTML$"<!DOCTYPE HTML>"
func escape(t:Text)->HTML:
t = t:replace("&", "&amp;")
t = t:replace("<", "&lt;")
@@ -12,16 +12,16 @@ lang HTML:
return HTML.from_unsafe_text("{i}")
func paragraph(content:HTML)->HTML:
- return $HTML{}"<p>{content}</p>"
+ return $HTML$"<p>$content</p>"
func main():
>> HTML.HEADER
= $HTML"<!DOCTYPE HTML>"
>> user := "I <3 hax"
- >> html := $HTML{}"Hello {user}!"
+ >> html := $HTML$"Hello $user!"
= $HTML"Hello I &lt;3 hax!"
- >> html ++ $HTML{}"<br>"
+ >> html ++ $HTML$"<br>"
= $HTML"Hello I &lt;3 hax!<br>"
>> $HTML{}"{1 + 2}"
@@ -32,3 +32,6 @@ func main():
>> html:paragraph()
= $HTML"<p>Hello I &lt;3 hax!</p>"
+
+ >> Text(html)
+ = "$HTML\"Hello I &lt;3 hax!\""