aboutsummaryrefslogtreecommitdiff
path: root/test/text.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-18 14:44:15 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-18 14:44:15 -0400
commitf4b04a1b8cd882e25fee592c819650c9b7e8566b (patch)
treedcecb8b4f83d569ebb00beb79988222d195b8f4c /test/text.tm
parent04603308af3a2984d42eaa9e301cac0ffbded2a4 (diff)
Improved syntax for dollar-string literals
Diffstat (limited to 'test/text.tm')
-rw-r--r--test/text.tm22
1 files changed, 19 insertions, 3 deletions
diff --git a/test/text.tm b/test/text.tm
index 4051a16f..2666b6c8 100644
--- a/test/text.tm
+++ b/test/text.tm
@@ -1,6 +1,6 @@
func main():
>> str := "Hello Amélie!"
- //! Testing strings like {str}
+ //! Testing strings like $str
>> str:upper()
= "HELLO AMÉLIE!"
@@ -19,7 +19,7 @@ func main():
>> \UE9 == \U65\U301
= yes
- >> amelie := "Am{\UE9}lie"
+ >> amelie := "Am$(\UE9)lie"
>> amelie:clusters()
= ["A", "m", "é", "l", "i", "e"] : [Text]
>> amelie:codepoints()
@@ -35,7 +35,7 @@ func main():
>> amelie:num_bytes()
= 8
- >> amelie2 := "Am{\U65\U301}lie"
+ >> amelie2 := "Am$(\U65\U301)lie"
>> amelie2:clusters()
= ["A", "m", "é", "l", "i", "e"] : [Text]
>> amelie2:codepoints()
@@ -103,3 +103,19 @@ func main():
"
= "line one\nline two"
+ //! Interpolation tests:
+ >> "A $(1+2)"
+ = "A 3"
+ >> '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 3"
+ >> $(one (nested) two $(1+2))
+ = "one (nested) two 3"