aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-06 22:26:12 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-06 22:26:12 -0400
commit3406515a44b13d0c290c28ac42bd364ce27560c7 (patch)
tree38000658e651ad19b9c8c2590df8fd6bb6faa4d7 /test
parentd8afa73368cdff38125fa1f7d17ad5ce54c84def (diff)
Make string escapes more normal: "\n" for newline, etc. Backticks can be
used to put in literal code without escape sequences.
Diffstat (limited to 'test')
-rw-r--r--test/lang.tm2
-rw-r--r--test/text.tm32
2 files changed, 17 insertions, 17 deletions
diff --git a/test/lang.tm b/test/lang.tm
index 081438ed..21b70f96 100644
--- a/test/lang.tm
+++ b/test/lang.tm
@@ -47,7 +47,7 @@ func main()
= $HTML"<p>Hello I &lt;3 hax!</p>"
>> Text(html)
- = '$HTML"Hello I &lt;3 hax!"'
+ = '\$HTML"Hello I &lt;3 hax!"'
>> b := Bold("Some <text> with junk")
>> $HTML"Your text: $b"
diff --git a/test/text.tm b/test/text.tm
index 1cabbdea..812ecd3f 100644
--- a/test/text.tm
+++ b/test/text.tm
@@ -34,22 +34,22 @@ func main()
>> str[9]
= "é"
- >> \UE9
+ >> "\{UE9}"
= "é"
- >> \U65\U301
+ >> "\{U65}\{U301}"
= "é"
- >> \{Penguin}.codepoint_names()
+ >> "\{Penguin}".codepoint_names()
= ["PENGUIN"]
- >> \[31;1]
- = "$\e[31;1m"
+ >> "\[31;1]"
+ = "\e[31;1m"
- >> \UE9 == \U65\U301
+ >> "\{UE9}" == "\{U65}\{U301}"
= yes
- amelie := "Am$(\UE9)lie"
+ amelie := "Am\{UE9}lie"
>> amelie.split()
= ["A", "m", "é", "l", "i", "e"]
>> amelie.utf32_codepoints()
@@ -61,7 +61,7 @@ func main()
>> Text.from_bytes([Byte(0xFF)])
= none
- amelie2 := "Am$(\U65\U301)lie"
+ amelie2 := "Am\{U65}\{U301}lie"
>> amelie2.split()
= ["A", "m", "é", "l", "i", "e"]
>> amelie2.utf32_codepoints()
@@ -98,20 +98,20 @@ func main()
line one
line two
"
- = "line one$\nline two"
+ = "line one\nline two"
say("Interpolation tests:")
>> "A $(1+2)"
= "A 3"
- >> 'A $(1+2)'
- = 'A $(1+2)'
+ >> "A \$(1+2)"
+ = "A \$(1+2)"
>> `A $(1+2)`
= "A 3"
>> $"A $(1+2)"
= "A 3"
>> $$"A $(1+2)"
- = 'A $(1+2)'
+ = "A \$(1+2)"
>> $="A =(1+2)"
= "A 3"
>> ${one {nested} two $(1+2)}
@@ -127,13 +127,13 @@ func main()
>> c == Text.from_bytes(c.bytes())!
= yes
- >> "one$(\n)two$(\n)three".lines()
+ >> "one\ntwo\nthree".lines()
= ["one", "two", "three"]
- >> "one$(\n)two$(\n)three$(\n)".lines()
+ >> "one\ntwo\nthree\n".lines()
= ["one", "two", "three"]
- >> "one$(\n)two$(\n)three$(\n\n)".lines()
+ >> "one\ntwo\nthree\n\n".lines()
= ["one", "two", "three", ""]
- >> "one$(\r\n)two$(\r\n)three$(\r\n)".lines()
+ >> "one\r\ntwo\r\nthree\r\n".lines()
= ["one", "two", "three"]
>> "".lines()
= []