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_EXPRESSION_DIR = new File(TEST_DATA_DIR, "expression");
private static final File[] SOURCE_TEST_FILES = {
new File("libraries/stdlib/test/language/RangeIterationTest.kt"),
new File("libraries/stdlib/test/language/RangeIterationJVMTest.kt")
new File("libraries/stdlib/test/ranges/RangeIterationTest.kt"),
new File("libraries/stdlib/test/ranges/RangeIterationJVMTest.kt")
};
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");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,6 @@ import junit.framework.Test;
@SuppressWarnings("JUnitTestCaseWithNoTests")
public final class StdLibBitwiseOperationsTest extends JsUnitTestBase {
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");
* you may not use this file except in compliance with the License.
@@ -30,8 +30,8 @@ public class StdLibJsArrayScriptTest extends StdLibTestBase {
@Override
protected RhinoResultChecker getResultChecker() {
return new CompositeRhinoResultsChecker(
new RhinoFunctionResultChecker(TEST_MODULE, "jstest", "testSize", 3.0),
new RhinoFunctionResultChecker(TEST_MODULE, "jstest", "testToListToString", "[]-[foo]-[foo, bar]")
new RhinoFunctionResultChecker(TEST_MODULE, "test.collections.js", "testSize", 3.0),
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");
* 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;
@SuppressWarnings("JUnitTestCaseWithNoTests")
public final class StdLibJavaUtilCollectionsTest extends JsUnitTestBase {
public final class StdLibJsCollectionsTest extends JsUnitTestBase {
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");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,6 @@ public class StdLibTestToJSTest extends StdLibQUnitTestSupport {
"libraries/stdlib/test",
"js/JsArrayTest.kt",
"js/MapJsTest.kt",
"GetOrElseTest.kt",
"collections/ListSpecificTest.kt",
"collections/IteratorsTest.kt",
"collections/CollectionBehaviors.kt",
@@ -38,8 +37,8 @@ public class StdLibTestToJSTest extends StdLibQUnitTestSupport {
"collections/SequenceTest.kt",
"collections/IterableTests.kt",
"collections/ArraysTest.kt",
"language/RangeTest.kt",
"language/RangeIterationTest.kt"
"ranges/RangeTest.kt",
"ranges/RangeIterationTest.kt"
);
}
@@ -1,12 +1,13 @@
package test.collections
package test.exceptions
import kotlin.test.*
import test.collections.assertArrayNotSameButEquals
import org.junit.Test as test
import java.io.PrintWriter
import java.io.*
class ExceptionTest {
class ExceptionJVMTest {
@test fun printStackTraceOnRuntimeException() {
assertPrintStackTrace(RuntimeException("Crikey!"))
+1 -1
View File
@@ -1,4 +1,4 @@
package test.compare
package test.comparisons
import java.util.*
import kotlin.test.*
@@ -17,7 +17,7 @@
package test.collections
import test.collections.behaviors.listBehavior
import test.compare.STRING_CASE_INSENSITIVE_ORDER
import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
import java.util.*
import kotlin.test.*
import org.junit.Test as test
@@ -22,11 +22,11 @@ class CollectionJVMTest {
@test fun removeAllWithDifferentEquality() {
val data = listOf(IdentityData(1), IdentityData(1))
val list = data.toArrayList()
val list = data.toMutableList()
list -= identitySetOf(data[0]) as Iterable<IdentityData>
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>
assertTrue(list2.isEmpty(), "Equality contains should be used")
@@ -20,8 +20,7 @@ import java.util.*
import kotlin.test.*
import org.junit.Test as test
import test.collections.behaviors.*
import test.compare.STRING_CASE_INSENSITIVE_ORDER
import java.io.Serializable
import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
import kotlin.comparisons.*
class CollectionTest {
@@ -762,11 +761,11 @@ class CollectionTest {
@test fun sortInPlace() {
val data = listOf(11, 3, 7)
val asc = data.toArrayList()
val asc = data.toMutableList()
asc.sort()
assertEquals(listOf(3, 7, 11), asc)
val desc = data.toArrayList()
val desc = data.toMutableList()
desc.sortDescending()
assertEquals(listOf(11, 7, 3), desc)
}
@@ -15,7 +15,7 @@ class MutableCollectionTest {
}
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() {
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package collections
package test.collections
import kotlin.test.assertEquals
import org.junit.Test as test
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package collections
package test.collections
import test.collections.behaviors.listBehavior
import test.collections.compare
+1 -1
View File
@@ -1,5 +1,5 @@
// this package referenced from testArrayScriptTest
package jstest
package test.collections.js
fun testSize(): Int {
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 kotlin.test.*
@@ -1,4 +1,4 @@
package test.collections
package test.collections.js
import java.util.*
@@ -8,7 +8,7 @@ import kotlin.comparisons.*
fun <T> List<T>.toArrayList() = this.toCollection(ArrayList<T>())
class JavautilCollectionsTest {
class JsCollectionsTest {
val TEST_LIST = arrayOf(2, 0, 9, 7, 1).toList()
val SORTED_TEST_LIST = arrayOf(0, 1, 2, 7, 9).toList()
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 java.util.*
import org.junit.Test as test
import java.util.*
import test.collections.*
import test.collections.behaviors.*
class ComplexMapJsTest : MapJsTest() {
// 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 org.junit.Test
import test.collections.behaviors.setBehavior
import test.collections.*
import test.collections.behaviors.*
import java.util.HashSet
import java.util.LinkedHashSet
@@ -1,9 +1,9 @@
package test.collections
package test.language
import org.junit.Test as test
import kotlin.test.*
class NaturalLanguageTest {
class EscapedTestNamesTest {
@test fun `strings equal`() {
val actual = "abc"
@@ -1,8 +1,9 @@
package test
package test.numbers
import kotlin.test.*
import org.junit.Test as test
// TODO: Run these tests during compiler test only (JVM & JS)
class BitwiseOperationsTest {
@test fun orForInt() {
assertEquals(3, 2 or 1)
@@ -20,7 +20,7 @@ import kotlin.test.*
import org.junit.Test as test
class CompanionObjectsExtensionsTest {
class CompanionIntrinsicObjectsJVMTest {
@test fun intTest() {
val i = Int
@@ -1,4 +1,4 @@
package test.collections
package test.numbers
import java.math.BigInteger
import java.math.BigDecimal
@@ -1,4 +1,4 @@
package numbers
package test.numbers
import java.math.BigDecimal
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 kotlin.test.*
@@ -1,4 +1,4 @@
package numbers
package test.ranges
import org.junit.Test
import org.junit.Test as test
@@ -1,4 +1,4 @@
package language
package test.ranges
import org.junit.Test
import kotlin.test.assertEquals
@@ -1,5 +1,4 @@
@file: Suppress("DEPRECATION_ERROR")
package language
package test.ranges
import java.lang.Integer.MAX_VALUE as MaxI
import java.lang.Integer.MIN_VALUE as MinI
@@ -1,5 +1,4 @@
@file: Suppress("DEPRECATION_ERROR")
package language
package test.ranges
import org.junit.Test as test
import kotlin.test.*
@@ -1,5 +1,4 @@
@file: Suppress("DEPRECATION_ERROR")
package language
package test.ranges
import kotlin.ranges.LongProgression.Companion
import java.lang.Double as jDouble
@@ -1,5 +1,4 @@
@file: Suppress("DEPRECATION_ERROR")
package language
package test.ranges
import kotlin.test.*
import org.junit.Test as test
@@ -1,4 +1,4 @@
package test.annotations
package test.reflection
import kotlin.test.*
import org.junit.Test as test
@@ -1,9 +1,9 @@
package test.collections
package test.utils
import org.junit.Test as test
import kotlin.test.*
class PreconditionsTest() {
class PreconditionsJVMTest() {
@test fun passingRequire() {
require(true)
+3 -23
View File
@@ -48,30 +48,10 @@
<exclude name="concurrent/**"/>
<exclude name="io/**"/>
<exclude name="reflection/**"/>
<exclude name="ExceptionTest.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"/>
<!-- Can't run: spaces in function name KT-4160 -->
<exclude name="language/EscapedTestNamesTest.kt"/>
</fileset>
<fileset dir="${basedir}/../../../js/js.libraries/test">