aboutsummaryrefslogtreecommitdiff
path: root/test/text.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-16 15:12:54 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-16 15:12:54 -0400
commit6d0f04375df942985292d0a6b6e487db9a09f3fa (patch)
treecad6fbb4008240cf7280b77fa226f9518f44faac /test/text.tm
parenta9a21c40d91ea75066023854739c6a98a36c8a76 (diff)
Have Text:matches() return an optional array of matches
Diffstat (limited to 'test/text.tm')
-rw-r--r--test/text.tm14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/text.tm b/test/text.tm
index f27eaf37..f87cedfb 100644
--- a/test/text.tm
+++ b/test/text.tm
@@ -251,13 +251,19 @@ func main():
= " good(x, fn(y), BAD(z), w) "
>> "Hello":matches($/{id}/)
- = yes
+ = ["Hello"]?
>> "Hello":matches($/{lower}/)
- = no
+ = ![Text]
>> "Hello":matches($/{upper}/)
- = no
+ = ![Text]
>> "Hello...":matches($/{id}/)
- = no
+ = ![Text]
+
+ if matches := "hello world":matches($/{id} {id}/):
+ >> matches
+ = ["hello", "world"]
+ else:
+ fail("Failed to match")
>> "hello world":map($/world/, Text.upper)
= "hello WORLD"