summaryrefslogtreecommitdiff
path: root/tests/typ/compiler
diff options
context:
space:
mode:
authorLaurenz Stampfl <47084093+LaurenzV@users.noreply.github.com>2023-04-25 11:22:20 +0200
committerGitHub <noreply@github.com>2023-04-25 11:22:20 +0200
commitf38989358e768ebe17c5f191cf9026d513e6f6b7 (patch)
tree1cc6f1637a824ab6471e7ca9550d44b4266d6cf4 /tests/typ/compiler
parentd5d98b67a83944d72a5c0f8e8e2f43aeee667122 (diff)
Add a zip method to arrays (#947)
Diffstat (limited to 'tests/typ/compiler')
-rw-r--r--tests/typ/compiler/array.typ11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/typ/compiler/array.typ b/tests/typ/compiler/array.typ
index c52160b0..5d7e8b63 100644
--- a/tests/typ/compiler/array.typ
+++ b/tests/typ/compiler/array.typ
@@ -224,6 +224,17 @@
#test((2, 1, 3, -10, -5, 8, 6, -7, 2).sorted(key: x => x * x), (1, 2, 2, 3, -5, 6, -7, 8, -10))
---
+// Test the `zip` method.
+#test(().zip(()), ())
+#test((1,).zip(()), ())
+#test((1,).zip((2,)), ((1, 2),))
+#test((1, 2).zip((3, 4)), ((1, 3), (2, 4)))
+#test((1, 2, 3, 4).zip((5, 6)), ((1, 5), (2, 6)))
+#test(((1, 2), 3).zip((4, 5)), (((1, 2), 4), (3, 5)))
+#test((1, "hi").zip((true, false)), ((1, true), ("hi", false)))
+
+
+---
// Error: 32-37 cannot divide by zero
#(1, 2, 0, 3).sorted(key: x => 5 / x)