Check for index-out-of-bound in elementAt function (KT-30051)

This commit is contained in:
Abduqodiri Qurbonzoda
2019-03-07 22:10:29 +03:00
parent 584137121b
commit ba61695a45
16 changed files with 496 additions and 60 deletions
@@ -625,10 +625,8 @@ class UnsignedArraysTest {
expect(1u) { ushortArrayOf(0, 1, 2).elementAt(1) }
expect(2u) { uintArrayOf(0, 1, 2).elementAt(2) }
// TODO: Uncomment these tests after KT-30051 gets fixed.
// Currently JS does not throw exception on incorrect index.
// assertFailsWith<IndexOutOfBoundsException> { uintArrayOf().elementAt(0) }
// assertFailsWith<IndexOutOfBoundsException> { ulongArrayOf(0, 1, 2).elementAt(-1) }
assertFailsWith<IndexOutOfBoundsException> { uintArrayOf().elementAt(0) }
assertFailsWith<IndexOutOfBoundsException> { ulongArrayOf(0, 1, 2).elementAt(-1) }
}
@Test