aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/arrays.tm25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/arrays.tm b/test/arrays.tm
index b609aa9b..9eea9dd9 100644
--- a/test/arrays.tm
+++ b/test/arrays.tm
@@ -118,3 +118,28 @@ func main():
>> sorted == sorted:sorted()
= yes
+ do:
+ >> [i*10 for i in 5]:from(3)
+ = [30, 40, 50]
+ >> [i*10 for i in 5]:from(last=3)
+ = [10, 20, 30]
+ >> [i*10 for i in 5]:from(last=-2)
+ = [10, 20, 30, 40]
+ >> [i*10 for i in 5]:from(-2)
+ = [40, 50]
+
+ >> [i*10 for i in 5]:by(2)
+ = [10, 30, 50]
+ >> [i*10 for i in 5]:by(-1)
+ = [50, 40, 30, 20, 10]
+
+ >> [10, 20, 30, 40]:by(2)
+ = [10, 30]
+ >> [10, 20, 30, 40]:by(-2)
+ = [40, 20]
+
+ >> [i*10 for i in 10]:by(2):by(2)
+ = [10, 50, 90]
+
+ >> [i*10 for i in 10]:by(2):by(-1)
+ = [90, 70, 50, 30, 10]