aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-02 23:07:08 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-02 23:07:08 -0400
commit6d7e09bf1801c2fe183df17cc67017a6d3d8513b (patch)
tree2c51df15ebab45a68ec36e9466e8e9f3813b48f6 /test
parent9214e621bf7fdaec29b872a5b0e757806fa61b40 (diff)
Add Text:split() and use that with an empty pattern instead of Text:clusters()
Diffstat (limited to 'test')
-rw-r--r--test/text.tm16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/text.tm b/test/text.tm
index dc342659..0955ffd2 100644
--- a/test/text.tm
+++ b/test/text.tm
@@ -20,7 +20,7 @@ func main():
= yes
>> amelie := "Am$(\UE9)lie"
- >> amelie:clusters()
+ >> amelie:split()
= ["A", "m", "é", "l", "i", "e"] : [Text]
>> amelie:utf32_codepoints()
= [65_i32, 109_i32, 233_i32, 108_i32, 105_i32, 101_i32] : [Int32]
@@ -28,7 +28,7 @@ func main():
= [65_i8, 109_i8, -61_i8, -87_i8, 108_i8, 105_i8, 101_i8] : [Int8]
>> amelie2 := "Am$(\U65\U301)lie"
- >> amelie2:clusters()
+ >> amelie2:split()
= ["A", "m", "é", "l", "i", "e"] : [Text]
>> amelie2:utf32_codepoints()
= [65_i32, 109_i32, 233_i32, 108_i32, 105_i32, 101_i32] : [Int32]
@@ -128,3 +128,15 @@ func main():
= ["one", "two", "three", ""]
>> "one$(\r\n)two$(\r\n)three$(\r\n)":lines()
= ["one", "two", "three"]
+
+ >> "one two three":split(" ")
+ = ["one", "two", "three"]
+
+ >> "one,two,three,":split(",")
+ = ["one", "two", "three", ""]
+
+ >> "one two three":split("[..space]")
+ = ["one", "two", "three"]
+
+ >> "abc":split("")
+ = ["a", "b", "c"]