diff --git a/libraries/stdlib/jvm/test/collections/IndexOverflowJVMTest.kt b/libraries/stdlib/jvm/test/collections/IndexOverflowJVMTest.kt index cd1eab7542d..d1704d0fce3 100644 --- a/libraries/stdlib/jvm/test/collections/IndexOverflowJVMTest.kt +++ b/libraries/stdlib/jvm/test/collections/IndexOverflowJVMTest.kt @@ -136,14 +136,14 @@ class IndexOverflowJVMTest { @Test fun foldIndexedOverflow() { - assertIndexOverflow { maxIndexSequence.foldIndexed("") { index, acc, s -> checkIndexPositive(index); s } } - assertIndexOverflow { maxIndexIterable.foldIndexed("") { index, acc, s -> checkIndexPositive(index); s } } + assertIndexOverflow { maxIndexSequence.foldIndexed("") { index, _, s -> checkIndexPositive(index); s } } + assertIndexOverflow { maxIndexIterable.foldIndexed("") { index, _, s -> checkIndexPositive(index); s } } } @Test fun reduceIndexedOverflow() { - assertIndexOverflow { maxIndexSequence.reduceIndexed { index, acc, s -> checkIndexPositive(index); s } } - assertIndexOverflow { maxIndexIterable.reduceIndexed { index, acc, s -> checkIndexPositive(index); s } } + assertIndexOverflow { maxIndexSequence.reduceIndexed { index, _, s -> checkIndexPositive(index); s } } + assertIndexOverflow { maxIndexIterable.reduceIndexed { index, _, s -> checkIndexPositive(index); s } } } diff --git a/libraries/stdlib/test/collections/ArraysTest.kt b/libraries/stdlib/test/collections/ArraysTest.kt index a1940563a95..06b7d314fa9 100644 --- a/libraries/stdlib/test/collections/ArraysTest.kt +++ b/libraries/stdlib/test/collections/ArraysTest.kt @@ -233,12 +233,6 @@ class ArraysTest { } @Test fun contentDeepToString() { - // Don't run this test unless primitive array `is` checks are supported (KT-17137) - if ((intArrayOf() as Any) is Array<*>) { - assertTrue(true) - return - } - val arr = arrayOf( "aa", 1, null, arrayOf(arrayOf("foo")), charArrayOf('d'), booleanArrayOf(false), intArrayOf(-1), longArrayOf(-1), shortArrayOf(-1), byteArrayOf(-1), diff --git a/libraries/stdlib/test/collections/SequenceTest.kt b/libraries/stdlib/test/collections/SequenceTest.kt index b26702d5de0..ff1b239e483 100644 --- a/libraries/stdlib/test/collections/SequenceTest.kt +++ b/libraries/stdlib/test/collections/SequenceTest.kt @@ -154,8 +154,10 @@ public class SequenceTest { assertFailsWith { fibonacci().drop(-1) } val dropMax = fibonacci().drop(Int.MAX_VALUE) - val dropMore = dropMax.drop(Int.MAX_VALUE) - val takeMore = dropMax.take(Int.MAX_VALUE) + run @Suppress("UNUSED_VARIABLE") { + val dropMore = dropMax.drop(Int.MAX_VALUE) + val takeMore = dropMax.take(Int.MAX_VALUE) + } } diff --git a/libraries/stdlib/test/ranges/RangeTest.kt b/libraries/stdlib/test/ranges/RangeTest.kt index 6f294f27907..cb56ea5c158 100644 --- a/libraries/stdlib/test/ranges/RangeTest.kt +++ b/libraries/stdlib/test/ranges/RangeTest.kt @@ -296,11 +296,12 @@ public class RangeTest { assertTrue(Double.MAX_VALUE in halfInfRange) } + @Suppress("EmptyRange") @Test fun isEmpty() { assertTrue((2..1).isEmpty()) assertTrue((2L..0L).isEmpty()) - assertTrue((1.toShort()..-1.toShort()).isEmpty()) - assertTrue((0.toByte()..-1.toByte()).isEmpty()) + assertTrue((1.toShort()..(-1).toShort()).isEmpty()) + assertTrue((0.toByte()..(-1).toByte()).isEmpty()) assertTrue((0f..-3.14f).isEmpty()) assertTrue((-2.72..-3.14).isEmpty()) assertTrue(('z'..'x').isEmpty()) @@ -315,6 +316,7 @@ public class RangeTest { assertTrue(("range".."progression").isEmpty()) } + @Suppress("ReplaceAssertBooleanWithAssertEquality", "EmptyRange") @Test fun emptyEquals() { assertTrue(IntRange.EMPTY == IntRange.EMPTY) assertEquals(IntRange.EMPTY, IntRange.EMPTY) @@ -340,14 +342,15 @@ public class RangeTest { assertFalse(("aa".."bb") == ("aaa".."bbb")) } + @Suppress("EmptyRange") @Test fun emptyHashCode() { assertEquals((0..42).hashCode(), (0..42).hashCode()) assertEquals((1.23..4.56).hashCode(), (1.23..4.56).hashCode()) assertEquals((0..-1).hashCode(), IntRange.EMPTY.hashCode()) assertEquals((2L..1L).hashCode(), (1L..0L).hashCode()) - assertEquals((0.toShort()..-1.toShort()).hashCode(), (42.toShort()..0.toShort()).hashCode()) - assertEquals((0.toByte()..-1.toByte()).hashCode(), (42.toByte()..0.toByte()).hashCode()) + assertEquals((0.toShort()..(-1).toShort()).hashCode(), (42.toShort()..0.toShort()).hashCode()) + assertEquals((0.toByte()..(-1).toByte()).hashCode(), (42.toByte()..0.toByte()).hashCode()) assertEquals((0f..-3.14f).hashCode(), (2.39f..1.41f).hashCode()) assertEquals((0.0..-10.0).hashCode(), (10.0..0.0).hashCode()) assertEquals(('z'..'x').hashCode(), ('l'..'k').hashCode()) @@ -390,8 +393,8 @@ public class RangeTest { assertFailsWithIllegalArgument { 'a'..'z' step 0 } assertFailsWithIllegalArgument { 0 downTo -5 step 0 } - assertFailsWithIllegalArgument { 0.toByte() downTo -5.toByte() step 0 } - assertFailsWithIllegalArgument { 0.toShort() downTo -5.toShort() step 0 } + assertFailsWithIllegalArgument { 0.toByte() downTo (-5).toByte() step 0 } + assertFailsWithIllegalArgument { 0.toShort() downTo (-5).toShort() step 0 } assertFailsWithIllegalArgument { 0L downTo -5L step 0L } assertFailsWithIllegalArgument { 'z' downTo 'a' step 0 } @@ -403,8 +406,8 @@ public class RangeTest { assertFailsWithIllegalArgument { 0 downTo -5 step -2 } - assertFailsWithIllegalArgument { 0.toByte() downTo -5.toByte() step -2 } - assertFailsWithIllegalArgument { 0.toShort() downTo -5.toShort() step -2 } + assertFailsWithIllegalArgument { 0.toByte() downTo (-5).toByte() step -2 } + assertFailsWithIllegalArgument { 0.toShort() downTo (-5).toShort() step -2 } assertFailsWithIllegalArgument { 0L downTo -5L step -2L } assertFailsWithIllegalArgument { 'z' downTo 'a' step -2 } }