diff options
author | nitely <ecastroborsani@gmail.com> | 2018-06-06 02:22:33 -0300 |
---|---|---|
committer | nitely <ecastroborsani@gmail.com> | 2018-06-06 02:22:33 -0300 |
commit | 7297195f9fc5aa47de4b64f1402cfc7af109badc (patch) | |
tree | 1ade823a5d3b0f72613cbc7855a453058a42cd7d /tests/system | |
parent | ba39f359aa6b28eb30f7165f9e629373c730b3b2 (diff) | |
download | Nim-7297195f9fc5aa47de4b64f1402cfc7af109badc.tar.gz |
test negative range array
Diffstat (limited to 'tests/system')
-rw-r--r-- | tests/system/tsystem_misc.nim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/system/tsystem_misc.nim b/tests/system/tsystem_misc.nim index 460d94d56..6d14aa68f 100644 --- a/tests/system/tsystem_misc.nim +++ b/tests/system/tsystem_misc.nim @@ -12,6 +12,9 @@ discard """ 3 4 2 +1 +2 +3 ''' """ @@ -72,3 +75,14 @@ oaEmpty(toOpenArray(seqq, 0, -1)) oaEmpty(toOpenArray(seqq, 1, 0)) oaEmpty(toOpenArray(seqq, 1, 2)) oaFirstElm(toOpenArray(seqq, 1, seqq.len-1)) + +var arrNeg: array[-3 .. -1, int] = [1, 2, 3] +foo(toOpenArray(arrNeg, -3, -1)) +foo(toOpenArray(arrNeg, 0, -1)) +foo(toOpenArray(arrNeg, -3, -4)) +doAssertRaises(IndexError): + foo(toOpenArray(arrNeg, -4, -1)) +doAssertRaises(IndexError): + foo(toOpenArray(arrNeg, -1, 0)) +doAssertRaises(IndexError): + foo(toOpenArray(arrNeg, -1, -3)) |