aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-06 00:03:28 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-06 00:03:28 -0400
commit44892df4c5686b292a058ca19eaba1e852fe42f3 (patch)
treeb01b46ef7e9496e1971616e3b55e124dfd217cbb /test
parent1000423d2b351f1f5edbb3c9a08898883ba47f3e (diff)
Add Text.trim()
Diffstat (limited to 'test')
-rw-r--r--test/text.tm12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/text.tm b/test/text.tm
index 450d8ae9..c98ca1c6 100644
--- a/test/text.tm
+++ b/test/text.tm
@@ -257,6 +257,18 @@ func main():
>> "Abc":repeat(3)
= "AbcAbcAbc"
+ >> " abc def ":trim()
+ = "abc def"
+ >> " abc123def ":trim($/{!digit}/)
+ = "123"
+ >> " abc123def ":trim($/{!digit}/, trim_left=no)
+ = " abc123"
+ >> " abc123def ":trim($/{!digit}/, trim_right=no)
+ = "123def "
+ # Only trim single whole matches that bookend the text:
+ >> "AbcAbcxxxxxxxxAbcAbc":trim($/Abc/)
+ = "AbcxxxxxxxxAbc"
+
do:
!! Testing concatenation-stability:
>> ab := Text.from_codepoint_names(["LATIN SMALL LETTER E", "COMBINING VERTICAL LINE BELOW"])