diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-02 23:47:16 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-02 23:47:16 -0400 |
| commit | 5aa5a5e99b322586eed9997a14b3d616540bef07 (patch) | |
| tree | c8eede952aa9ff49cea8f981d48e0b5faad291b2 /test | |
| parent | 5d6fa135b1eadbceac04e5456fabb7e53feedc10 (diff) | |
Fix some stuff around Text:find() and text indexing
Diffstat (limited to 'test')
| -rw-r--r-- | test/text.tm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/text.tm b/test/text.tm index 0dd5f2ec..39e8a6e1 100644 --- a/test/text.tm +++ b/test/text.tm @@ -129,6 +129,7 @@ func main(): >> "one$(\r\n)two$(\r\n)three$(\r\n)":lines() = ["one", "two", "three"] + //! Test splitting and joining text: >> "one two three":split(" ") = ["one", "two", "three"] @@ -156,6 +157,7 @@ func main(): >> "":split() = [] + //! Test text:find_all() >> " one two three ":find_all("[..alpha]") = ["one", "two", "three"] @@ -173,3 +175,19 @@ func main(): >> "Hello":find_all("") = [] + + //! Test text:find() + >> " one two three ":find("[..id]", start=-999) + = 0 + >> " one two three ":find("[..id]", start=999) + = 0 + >> " one two three ":find("[..id]") + = 2 + >> " one two three ":find("[..id]", start=5) + = 8 + + >> len := 0_i64 + >> " one ":find("[..id]", length=&len) + = 4 + >> len + = 3_i64 |
