Rearrange stdlib unit tests across packages.

Rearrange JS stdlib unit tests.
This commit is contained in:
Ilya Gorbunov
2016-06-17 00:13:05 +03:00
parent d266f546f4
commit c5a208f3eb
33 changed files with 57 additions and 80 deletions
@@ -36,8 +36,8 @@ public class GenerateRangesCodegenTestData {
private static final File AS_LITERAL_DIR = new File(TEST_DATA_DIR, "literal"); private static final File AS_LITERAL_DIR = new File(TEST_DATA_DIR, "literal");
private static final File AS_EXPRESSION_DIR = new File(TEST_DATA_DIR, "expression"); private static final File AS_EXPRESSION_DIR = new File(TEST_DATA_DIR, "expression");
private static final File[] SOURCE_TEST_FILES = { private static final File[] SOURCE_TEST_FILES = {
new File("libraries/stdlib/test/language/RangeIterationTest.kt"), new File("libraries/stdlib/test/ranges/RangeIterationTest.kt"),
new File("libraries/stdlib/test/language/RangeIterationJVMTest.kt") new File("libraries/stdlib/test/ranges/RangeIterationJVMTest.kt")
}; };
private static final Pattern TEST_FUN_PATTERN = Pattern.compile("test fun (\\w+)\\(\\) \\{.+?}", Pattern.DOTALL); private static final Pattern TEST_FUN_PATTERN = Pattern.compile("test fun (\\w+)\\(\\) \\{.+?}", Pattern.DOTALL);
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2015 JetBrains s.r.o. * Copyright 2010-2016 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -22,6 +22,6 @@ import junit.framework.Test;
@SuppressWarnings("JUnitTestCaseWithNoTests") @SuppressWarnings("JUnitTestCaseWithNoTests")
public final class StdLibBitwiseOperationsTest extends JsUnitTestBase { public final class StdLibBitwiseOperationsTest extends JsUnitTestBase {
public static Test suite() throws Exception { public static Test suite() throws Exception {
return createTestSuiteForFile("libraries/stdlib/test/language/BitwiseOperationsTest.kt"); return createTestSuiteForFile("libraries/stdlib/test/numbers/BitwiseOperationsTest.kt");
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2015 JetBrains s.r.o. * Copyright 2010-2016 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -30,8 +30,8 @@ public class StdLibJsArrayScriptTest extends StdLibTestBase {
@Override @Override
protected RhinoResultChecker getResultChecker() { protected RhinoResultChecker getResultChecker() {
return new CompositeRhinoResultsChecker( return new CompositeRhinoResultsChecker(
new RhinoFunctionResultChecker(TEST_MODULE, "jstest", "testSize", 3.0), new RhinoFunctionResultChecker(TEST_MODULE, "test.collections.js", "testSize", 3.0),
new RhinoFunctionResultChecker(TEST_MODULE, "jstest", "testToListToString", "[]-[foo]-[foo, bar]") new RhinoFunctionResultChecker(TEST_MODULE, "test.collections.js", "testToListToString", "[]-[foo]-[foo, bar]")
); );
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2015 JetBrains s.r.o. * Copyright 2010-2016 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@ package org.jetbrains.kotlin.js.test.semantics;
import junit.framework.Test; import junit.framework.Test;
@SuppressWarnings("JUnitTestCaseWithNoTests") @SuppressWarnings("JUnitTestCaseWithNoTests")
public final class StdLibJavaUtilCollectionsTest extends JsUnitTestBase { public final class StdLibJsCollectionsTest extends JsUnitTestBase {
public static Test suite() throws Exception { public static Test suite() throws Exception {
return createTestSuiteForFile("libraries/stdlib/test/js/javautilCollectionsTest.kt"); return createTestSuiteForFile("libraries/stdlib/test/js/JsCollectionsTest.kt");
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2015 JetBrains s.r.o. * Copyright 2010-2016 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ public class StdLibTestToJSTest extends StdLibQUnitTestSupport {
"libraries/stdlib/test", "libraries/stdlib/test",
"js/JsArrayTest.kt", "js/JsArrayTest.kt",
"js/MapJsTest.kt", "js/MapJsTest.kt",
"GetOrElseTest.kt",
"collections/ListSpecificTest.kt", "collections/ListSpecificTest.kt",
"collections/IteratorsTest.kt", "collections/IteratorsTest.kt",
"collections/CollectionBehaviors.kt", "collections/CollectionBehaviors.kt",
@@ -38,8 +37,8 @@ public class StdLibTestToJSTest extends StdLibQUnitTestSupport {
"collections/SequenceTest.kt", "collections/SequenceTest.kt",
"collections/IterableTests.kt", "collections/IterableTests.kt",
"collections/ArraysTest.kt", "collections/ArraysTest.kt",
"language/RangeTest.kt", "ranges/RangeTest.kt",
"language/RangeIterationTest.kt" "ranges/RangeIterationTest.kt"
); );
} }
@@ -1,12 +1,13 @@
package test.collections package test.exceptions
import kotlin.test.* import kotlin.test.*
import test.collections.assertArrayNotSameButEquals
import org.junit.Test as test import org.junit.Test as test
import java.io.PrintWriter import java.io.PrintWriter
import java.io.* import java.io.*
class ExceptionTest { class ExceptionJVMTest {
@test fun printStackTraceOnRuntimeException() { @test fun printStackTraceOnRuntimeException() {
assertPrintStackTrace(RuntimeException("Crikey!")) assertPrintStackTrace(RuntimeException("Crikey!"))
+1 -1
View File
@@ -1,4 +1,4 @@
package test.compare package test.comparisons
import java.util.* import java.util.*
import kotlin.test.* import kotlin.test.*
@@ -17,7 +17,7 @@
package test.collections package test.collections
import test.collections.behaviors.listBehavior import test.collections.behaviors.listBehavior
import test.compare.STRING_CASE_INSENSITIVE_ORDER import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
import java.util.* import java.util.*
import kotlin.test.* import kotlin.test.*
import org.junit.Test as test import org.junit.Test as test
@@ -22,11 +22,11 @@ class CollectionJVMTest {
@test fun removeAllWithDifferentEquality() { @test fun removeAllWithDifferentEquality() {
val data = listOf(IdentityData(1), IdentityData(1)) val data = listOf(IdentityData(1), IdentityData(1))
val list = data.toArrayList() val list = data.toMutableList()
list -= identitySetOf(data[0]) as Iterable<IdentityData> list -= identitySetOf(data[0]) as Iterable<IdentityData>
assertTrue(list.single() === data[1], "Identity contains should be used") assertTrue(list.single() === data[1], "Identity contains should be used")
val list2 = data.toArrayList() val list2 = data.toMutableList()
list2 -= hashSetOf(data[0]) as Iterable<IdentityData> list2 -= hashSetOf(data[0]) as Iterable<IdentityData>
assertTrue(list2.isEmpty(), "Equality contains should be used") assertTrue(list2.isEmpty(), "Equality contains should be used")
@@ -20,8 +20,7 @@ import java.util.*
import kotlin.test.* import kotlin.test.*
import org.junit.Test as test import org.junit.Test as test
import test.collections.behaviors.* import test.collections.behaviors.*
import test.compare.STRING_CASE_INSENSITIVE_ORDER import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
import java.io.Serializable
import kotlin.comparisons.* import kotlin.comparisons.*
class CollectionTest { class CollectionTest {
@@ -762,11 +761,11 @@ class CollectionTest {
@test fun sortInPlace() { @test fun sortInPlace() {
val data = listOf(11, 3, 7) val data = listOf(11, 3, 7)
val asc = data.toArrayList() val asc = data.toMutableList()
asc.sort() asc.sort()
assertEquals(listOf(3, 7, 11), asc) assertEquals(listOf(3, 7, 11), asc)
val desc = data.toArrayList() val desc = data.toMutableList()
desc.sortDescending() desc.sortDescending()
assertEquals(listOf(11, 7, 3), desc) assertEquals(listOf(11, 7, 3), desc)
} }
@@ -15,7 +15,7 @@ class MutableCollectionTest {
} }
fun <T> testOperation(before: List<T>, after: List<T>, expectedModified: Boolean) fun <T> testOperation(before: List<T>, after: List<T>, expectedModified: Boolean)
= testOperation(before, after, expectedModified, { it.toArrayList() }) = testOperation(before, after, expectedModified, { it.toMutableList() })
@test fun addAll() { @test fun addAll() {
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package collections package test.collections
import kotlin.test.assertEquals import kotlin.test.assertEquals
import org.junit.Test as test import org.junit.Test as test
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package collections package test.collections
import test.collections.behaviors.listBehavior import test.collections.behaviors.listBehavior
import test.collections.compare import test.collections.compare
+1 -1
View File
@@ -1,5 +1,5 @@
// this package referenced from testArrayScriptTest // this package referenced from testArrayScriptTest
package jstest package test.collections.js
fun testSize(): Int { fun testSize(): Int {
val a1 = arrayOf<String>() val a1 = arrayOf<String>()
+1 -1
View File
@@ -1,4 +1,4 @@
package test.collections package test.collections.js
import org.junit.Test as test import org.junit.Test as test
import kotlin.test.* import kotlin.test.*
@@ -1,4 +1,4 @@
package test.collections package test.collections.js
import java.util.* import java.util.*
@@ -8,7 +8,7 @@ import kotlin.comparisons.*
fun <T> List<T>.toArrayList() = this.toCollection(ArrayList<T>()) fun <T> List<T>.toArrayList() = this.toCollection(ArrayList<T>())
class JavautilCollectionsTest { class JsCollectionsTest {
val TEST_LIST = arrayOf(2, 0, 9, 7, 1).toList() val TEST_LIST = arrayOf(2, 0, 9, 7, 1).toList()
val SORTED_TEST_LIST = arrayOf(0, 1, 2, 7, 9).toList() val SORTED_TEST_LIST = arrayOf(0, 1, 2, 7, 9).toList()
val MAX_ELEMENT = 9 val MAX_ELEMENT = 9
+4 -4
View File
@@ -1,10 +1,10 @@
package test.collections package test.collections.js
import test.collections.behaviors.mapBehavior
import kotlin.test.* import kotlin.test.*
import java.util.*
import org.junit.Test as test import org.junit.Test as test
import java.util.*
import test.collections.*
import test.collections.behaviors.*
class ComplexMapJsTest : MapJsTest() { class ComplexMapJsTest : MapJsTest() {
// Helper function with generic parameter to force to use ComlpexHashMap // Helper function with generic parameter to force to use ComlpexHashMap
+3 -2
View File
@@ -1,8 +1,9 @@
package test.collections package test.collections.js
import kotlin.test.* import kotlin.test.*
import org.junit.Test import org.junit.Test
import test.collections.behaviors.setBehavior import test.collections.*
import test.collections.behaviors.*
import java.util.HashSet import java.util.HashSet
import java.util.LinkedHashSet import java.util.LinkedHashSet
@@ -1,9 +1,9 @@
package test.collections package test.language
import org.junit.Test as test import org.junit.Test as test
import kotlin.test.* import kotlin.test.*
class NaturalLanguageTest { class EscapedTestNamesTest {
@test fun `strings equal`() { @test fun `strings equal`() {
val actual = "abc" val actual = "abc"
@@ -1,8 +1,9 @@
package test package test.numbers
import kotlin.test.* import kotlin.test.*
import org.junit.Test as test import org.junit.Test as test
// TODO: Run these tests during compiler test only (JVM & JS)
class BitwiseOperationsTest { class BitwiseOperationsTest {
@test fun orForInt() { @test fun orForInt() {
assertEquals(3, 2 or 1) assertEquals(3, 2 or 1)
@@ -20,7 +20,7 @@ import kotlin.test.*
import org.junit.Test as test import org.junit.Test as test
class CompanionObjectsExtensionsTest { class CompanionIntrinsicObjectsJVMTest {
@test fun intTest() { @test fun intTest() {
val i = Int val i = Int
@@ -1,4 +1,4 @@
package test.collections package test.numbers
import java.math.BigInteger import java.math.BigInteger
import java.math.BigDecimal import java.math.BigDecimal
@@ -1,4 +1,4 @@
package numbers package test.numbers
import java.math.BigDecimal import java.math.BigDecimal
import org.junit.Test as test import org.junit.Test as test
+1 -1
View File
@@ -1,4 +1,4 @@
package numbers package test.numbers
import org.junit.Test as test import org.junit.Test as test
import kotlin.test.* import kotlin.test.*
@@ -1,4 +1,4 @@
package numbers package test.ranges
import org.junit.Test import org.junit.Test
import org.junit.Test as test import org.junit.Test as test
@@ -1,4 +1,4 @@
package language package test.ranges
import org.junit.Test import org.junit.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
@@ -1,5 +1,4 @@
@file: Suppress("DEPRECATION_ERROR") package test.ranges
package language
import java.lang.Integer.MAX_VALUE as MaxI import java.lang.Integer.MAX_VALUE as MaxI
import java.lang.Integer.MIN_VALUE as MinI import java.lang.Integer.MIN_VALUE as MinI
@@ -1,5 +1,4 @@
@file: Suppress("DEPRECATION_ERROR") package test.ranges
package language
import org.junit.Test as test import org.junit.Test as test
import kotlin.test.* import kotlin.test.*
@@ -1,5 +1,4 @@
@file: Suppress("DEPRECATION_ERROR") package test.ranges
package language
import kotlin.ranges.LongProgression.Companion import kotlin.ranges.LongProgression.Companion
import java.lang.Double as jDouble import java.lang.Double as jDouble
@@ -1,5 +1,4 @@
@file: Suppress("DEPRECATION_ERROR") package test.ranges
package language
import kotlin.test.* import kotlin.test.*
import org.junit.Test as test import org.junit.Test as test
@@ -1,4 +1,4 @@
package test.annotations package test.reflection
import kotlin.test.* import kotlin.test.*
import org.junit.Test as test import org.junit.Test as test
@@ -1,9 +1,9 @@
package test.collections package test.utils
import org.junit.Test as test import org.junit.Test as test
import kotlin.test.* import kotlin.test.*
class PreconditionsTest() { class PreconditionsJVMTest() {
@test fun passingRequire() { @test fun passingRequire() {
require(true) require(true)
+3 -23
View File
@@ -48,30 +48,10 @@
<exclude name="concurrent/**"/> <exclude name="concurrent/**"/>
<exclude name="io/**"/> <exclude name="io/**"/>
<exclude name="reflection/**"/>
<exclude name="ExceptionTest.kt"/> <!-- Can't run: spaces in function name KT-4160 -->
<exclude name="language/EscapedTestNamesTest.kt"/>
<!-- test for javaClass<T>()-->
<exclude name="JavaClassTest.kt"/>
<!-- javaClass(), Retention etc. -->
<exclude name="AnnotationsTest.kt"/>
<!-- Something missed in JS:-->
<!-- BigInteger, BigDecimal -->
<exclude name="MathTest.kt"/>
<!-- ByteArray.inputStream -->
<exclude name="OldStdlibTest.kt"/>
<!-- failsWith, javaClass -->
<exclude name="PreconditionsTest.kt"/>
<!-- dom.createDocument -->
<exclude name="dom/*.kt"/>
<!-- dom.createDocument -->
<exclude name="browser/BrowserTest.kt"/>
<!-- Can't run: spaces in function name -->
<exclude name="NaturalLanguageTest.kt"/>
</fileset> </fileset>
<fileset dir="${basedir}/../../../js/js.libraries/test"> <fileset dir="${basedir}/../../../js/js.libraries/test">