summaryrefslogtreecommitdiff
path: root/tests/typ/compiler/array.typ
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ/compiler/array.typ')
-rw-r--r--tests/typ/compiler/array.typ11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/typ/compiler/array.typ b/tests/typ/compiler/array.typ
index 5d7e8b63..ef6e4b6b 100644
--- a/tests/typ/compiler/array.typ
+++ b/tests/typ/compiler/array.typ
@@ -47,18 +47,23 @@
---
// Test rvalue out of bounds.
-// Error: 2-17 array index out of bounds (index: 5, len: 3)
+// Error: 2-17 array index out of bounds (index: 5, len: 3) and no default value was specified
#(1, 2, 3).at(5)
---
// Test lvalue out of bounds.
#{
let array = (1, 2, 3)
- // Error: 3-14 array index out of bounds (index: 3, len: 3)
+ // Error: 3-14 array index out of bounds (index: 3, len: 3) and no default value was specified
array.at(3) = 5
}
---
+// Test default value.
+#test((1, 2, 3).at(2, default: 5), 3)
+#test((1, 2, 3).at(3, default: 5), 5)
+
+---
// Test bad lvalue.
// Error: 2:3-2:14 cannot mutate a temporary value
#let array = (1, 2, 3)
@@ -243,7 +248,7 @@
#([Hi], [There]).sorted()
---
-// Error: 2-18 array index out of bounds (index: -4, len: 3)
+// Error: 2-18 array index out of bounds (index: -4, len: 3) and no default value was specified
#(1, 2, 3).at(-4)
---