From 5aa5a5e99b322586eed9997a14b3d616540bef07 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 2 Sep 2024 23:47:16 -0400 Subject: Fix some stuff around Text:find() and text indexing --- test/text.tm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') 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 -- cgit v1.2.3