aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-02 23:56:08 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-02 23:56:08 -0400
commit6c22999eded909b77b1d7718cf3f1dc969b55779 (patch)
tree2dd833569ae33890bf61d891b84e4c2eaf9db16f /test
parent5aa5a5e99b322586eed9997a14b3d616540bef07 (diff)
Add text slicing
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 39e8a6e1..afd0305a 100644
--- a/test/text.tm
+++ b/test/text.tm
@@ -191,3 +191,15 @@ func main():
= 4
>> len
= 3_i64
+
+ //! Test text slicing:
+ >> "abcdef":slice()
+ = "abcdef"
+ >> "abcdef":slice(from=3)
+ = "cdef"
+ >> "abcdef":slice(to=-2)
+ = "abcde"
+ >> "abcdef":slice(from=2, to=4)
+ = "bcd"
+ >> "abcdef":slice(from=5, to=1)
+ = ""