diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibArraysTest.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibArraysTest.java deleted file mode 100644 index bdc81445737..00000000000 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibArraysTest.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.js.test.semantics; - -import junit.framework.Test; - -@SuppressWarnings("JUnitTestCaseWithNoTests") -public final class StdLibArraysTest extends JsUnitTestBase { - public static Test suite() throws Exception { - return createTestSuiteForFile("libraries/stdlib/test/collections/ArraysTest.kt"); - } -} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibTestToJSTest.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibTestToJSTest.java index 692fb9d4eae..a0c13ab0d62 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibTestToJSTest.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibTestToJSTest.java @@ -39,6 +39,7 @@ public class StdLibTestToJSTest extends StdLibQUnitTestSupport { "dom/DomTest.kt", "collections/SequenceTest.kt", "collections/IterableTests.kt", + "collections/ArraysTest.kt", "language/RangeTest.kt", "language/RangeIterationTest.kt" ); diff --git a/libraries/stdlib/test/collections/CollectionTest.kt b/libraries/stdlib/test/collections/CollectionTest.kt index b33dd6f24eb..5e2d47129ac 100644 --- a/libraries/stdlib/test/collections/CollectionTest.kt +++ b/libraries/stdlib/test/collections/CollectionTest.kt @@ -658,18 +658,3 @@ class CollectionTest { assertEquals("[1, a, null, ${Long.MAX_VALUE.toString()}]", listOf(1, "a", null, Long.MAX_VALUE).toString()) } } - -fun Iterable.assertSorted(isInOrder: (T, T) -> Boolean): Unit { this.iterator().assertSorted(isInOrder) } -fun Iterator.assertSorted(isInOrder: (T, T) -> Boolean) { - if (!hasNext()) return - var index = 0 - var prev = next() - while (hasNext()) { - index += 1 - val next = next() - assertTrue(isInOrder(prev, next), "Not in order at position $index, element[${index-1}]: $prev, element[$index]: $next") - prev = next - } - return -} - diff --git a/libraries/stdlib/test/collections/IterableTests.kt b/libraries/stdlib/test/collections/IterableTests.kt index 60ea5810072..c346b4e4ede 100644 --- a/libraries/stdlib/test/collections/IterableTests.kt +++ b/libraries/stdlib/test/collections/IterableTests.kt @@ -350,3 +350,19 @@ abstract class IterableTests>(val data: T, val empty: T) { } } + + +fun Iterable.assertSorted(isInOrder: (T, T) -> Boolean): Unit { this.iterator().assertSorted(isInOrder) } +fun Iterator.assertSorted(isInOrder: (T, T) -> Boolean) { + if (!hasNext()) return + var index = 0 + var prev = next() + while (hasNext()) { + index += 1 + val next = next() + assertTrue(isInOrder(prev, next), "Not in order at position $index, element[${index-1}]: $prev, element[$index]: $next") + prev = next + } + return +} +