diff options
Diffstat (limited to 'tests/typ/code/array.typ')
| -rw-r--r-- | tests/typ/code/array.typ | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/typ/code/array.typ b/tests/typ/code/array.typ index df37dd45..cd163175 100644 --- a/tests/typ/code/array.typ +++ b/tests/typ/code/array.typ @@ -31,21 +31,33 @@ --- // Test rvalue out of bounds. +// Error: 2-14 array index out of bounds (index: 5, len: 3) +{(1, 2, 3)(5)} + +--- +// Test lvalue out of bounds. { let array = (1, 2, 3) - // Error: 3-11 array index out of bounds (index: 5, len: 3) - array(5) + // Error: 3-11 array index out of bounds (index: 3, len: 3) + array(3) = 5 } --- -// Test lvalue out of bounds. +// Test negative indices. { - let array = (1, 2, 3) - // Error: 3-12 array index out of bounds (index: -1, len: 3) - array(-1) = 5 + let array = (1, 2, 3, 4) + test(array(0), 1) + test(array(-1), 4) + test(array(-2), 3) + test(array(-3), 2) + test(array(-4), 1) } --- +// Error: 2-15 array index out of bounds (index: -4, len: 3) +{(1, 2, 3)(-4)} + +--- // Test non-collection indexing. { |
