Use kotlin.test.Test instead of org.junit.Test in common stdlib tests

(and in jvm-only and js-only tests also)
This commit is contained in:
Ilya Gorbunov
2017-10-12 07:23:13 +03:00
parent f002493218
commit 20b122c1dd
67 changed files with 16 additions and 92 deletions
+1 -2
View File
@@ -2,11 +2,10 @@ package test.js
import kotlin.js.* import kotlin.js.*
import kotlin.test.* import kotlin.test.*
import org.junit.Test as test
class JsonTest { class JsonTest {
@test fun createJsonFromPairs() { @Test fun createJsonFromPairs() {
var obj = json(Pair("firstName", "John"), Pair("lastName", "Doe"), Pair("age", 30)) var obj = json(Pair("firstName", "John"), Pair("lastName", "Doe"), Pair("age", 30))
assertEquals("John", obj["firstName"], "firstName") assertEquals("John", obj["firstName"], "firstName")
assertEquals("Doe", obj["lastName"], "lastName") assertEquals("Doe", obj["lastName"], "lastName")
+3 -4
View File
@@ -1,23 +1,22 @@
package test.js package test.js
import org.junit.Test as test
import kotlin.test.* import kotlin.test.*
class NumbersJsTest { class NumbersJsTest {
@test fun longMinMaxValues() { @Test fun longMinMaxValues() {
assertEquals(js("Kotlin.Long.MIN_VALUE"), Long.MIN_VALUE) assertEquals(js("Kotlin.Long.MIN_VALUE"), Long.MIN_VALUE)
assertEquals(js("Kotlin.Long.MAX_VALUE"), Long.MAX_VALUE) assertEquals(js("Kotlin.Long.MAX_VALUE"), Long.MAX_VALUE)
} }
@test fun doubleMinMaxValues() { @Test fun doubleMinMaxValues() {
assertEquals(js("Number.MIN_VALUE"), Double.MIN_VALUE) assertEquals(js("Number.MIN_VALUE"), Double.MIN_VALUE)
assertEquals(js("Number.MAX_VALUE"), Double.MAX_VALUE) assertEquals(js("Number.MAX_VALUE"), Double.MAX_VALUE)
assertEquals(js("Number.POSITIVE_INFINITY"), Double.POSITIVE_INFINITY) assertEquals(js("Number.POSITIVE_INFINITY"), Double.POSITIVE_INFINITY)
assertEquals(js("Number.NEGATIVE_INFINITY"), Double.NEGATIVE_INFINITY) assertEquals(js("Number.NEGATIVE_INFINITY"), Double.NEGATIVE_INFINITY)
} }
@test fun floatMinMaxValues() { @Test fun floatMinMaxValues() {
assertEquals(js("Number.MIN_VALUE"), Float.MIN_VALUE) assertEquals(js("Number.MIN_VALUE"), Float.MIN_VALUE)
assertEquals(js("Number.MAX_VALUE"), Float.MAX_VALUE) assertEquals(js("Number.MAX_VALUE"), Float.MAX_VALUE)
assertEquals(js("Number.POSITIVE_INFINITY"), Float.POSITIVE_INFINITY) assertEquals(js("Number.POSITIVE_INFINITY"), Float.POSITIVE_INFINITY)
+4 -5
View File
@@ -19,17 +19,16 @@ package test.js
import kotlin.js.* import kotlin.js.*
import kotlin.test.* import kotlin.test.*
import org.junit.Test as test
class RegExpTest { class RegExpTest {
@test fun regExpToString() { @Test fun regExpToString() {
val pattern = "q(\\d+)d" val pattern = "q(\\d+)d"
val re = RegExp(pattern, "i") val re = RegExp(pattern, "i")
assertEquals("/$pattern/i", re.toString()) assertEquals("/$pattern/i", re.toString())
} }
@test fun regExpProperties() { @Test fun regExpProperties() {
val re1 = RegExp("[a-z]", "img") val re1 = RegExp("[a-z]", "img")
assertTrue(re1.global) assertTrue(re1.global)
assertTrue(re1.ignoreCase) assertTrue(re1.ignoreCase)
@@ -40,7 +39,7 @@ class RegExpTest {
assertFalse(re2.multiline) assertFalse(re2.multiline)
} }
@test fun regExpTest() { @Test fun regExpTest() {
val pattern = "q(\\d+)d" val pattern = "q(\\d+)d"
val re = RegExp(pattern, "i") val re = RegExp(pattern, "i")
@@ -51,7 +50,7 @@ class RegExpTest {
} }
@test fun regExpExec() { @Test fun regExpExec() {
val string = "R2D2 beats A5D5 " val string = "R2D2 beats A5D5 "
var re = RegExp("""(\w\d)(\w\d)""", "g") var re = RegExp("""(\w\d)(\w\d)""", "g")
val m1 = re.exec(string)!! val m1 = re.exec(string)!!
@@ -4,7 +4,6 @@ package test.exceptions
import kotlin.test.* import kotlin.test.*
import test.collections.assertArrayNotSameButEquals import test.collections.assertArrayNotSameButEquals
import org.junit.Test
import java.io.PrintWriter import java.io.PrintWriter
import java.io.* import java.io.*
import java.nio.charset.Charset import java.nio.charset.Charset
-1
View File
@@ -1,7 +1,6 @@
package test.comparisons package test.comparisons
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import kotlin.comparisons.* import kotlin.comparisons.*
data class Item(val name: String, val rating: Int) : Comparable<Item> { data class Item(val name: String, val rating: Int) : Comparable<Item> {
+1 -4
View File
@@ -1,9 +1,6 @@
package test.tuples package test.tuples
import org.junit.Test import kotlin.test.*
import kotlin.test.assertTrue
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
class PairTest { class PairTest {
val p = Pair(1, "a") val p = Pair(1, "a")
@@ -19,7 +19,6 @@ package test.collections
import test.collections.behaviors.* import test.collections.behaviors.*
import test.comparisons.STRING_CASE_INSENSITIVE_ORDER import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import kotlin.comparisons.* import kotlin.comparisons.*
fun <T> assertArrayNotSameButEquals(expected: Array<out T>, actual: Array<out T>, message: String = "") { assertTrue(expected !== actual && expected contentEquals actual, message) } fun <T> assertArrayNotSameButEquals(expected: Array<out T>, actual: Array<out T>, message: String = "") { assertTrue(expected !== actual && expected contentEquals actual, message) }
@@ -9,7 +9,6 @@ import kotlin.test.*
import kotlin.comparisons.* import kotlin.comparisons.*
import java.util.* import java.util.*
import org.junit.Test
import test.io.deserializeFromHex import test.io.deserializeFromHex
import test.io.serializeAndDeserialize import test.io.serializeAndDeserialize
@@ -17,7 +17,6 @@
package test.collections package test.collections
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import test.collections.behaviors.* import test.collections.behaviors.*
import test.comparisons.STRING_CASE_INSENSITIVE_ORDER import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
import kotlin.comparisons.* import kotlin.comparisons.*
@@ -1,6 +1,5 @@
package test.collections package test.collections
import org.junit.Test
import kotlin.test.* import kotlin.test.*
class GroupingTest { class GroupingTest {
@@ -16,7 +16,6 @@
package test.collections package test.collections
import org.junit.Test
import test.* import test.*
import kotlin.test.* import kotlin.test.*
@@ -1,7 +1,6 @@
@file:kotlin.jvm.JvmVersion @file:kotlin.jvm.JvmVersion
package test.collections package test.collections
import org.junit.Test
import kotlin.test.* import kotlin.test.*
import java.util.* import java.util.*
@@ -1,7 +1,6 @@
package test.collections package test.collections
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class IteratorsTest { class IteratorsTest {
@Test fun iterationOverIterator() { @Test fun iterationOverIterator() {
@@ -1,7 +1,6 @@
package test.collections.binarySearch package test.collections.binarySearch
import org.junit.Test import kotlin.test.*
import kotlin.test.assertEquals
import kotlin.comparisons.* import kotlin.comparisons.*
class ListBinarySearchTest { class ListBinarySearchTest {
@@ -1,7 +1,6 @@
package test.collections package test.collections
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class ListSpecificTest { class ListSpecificTest {
val data = listOf("foo", "bar") val data = listOf("foo", "bar")
@@ -3,10 +3,7 @@ package test.collections
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentMap import java.util.concurrent.ConcurrentMap
import kotlin.test.assertEquals import kotlin.test.*
import kotlin.test.assertFails
import kotlin.test.expect
import org.junit.Test
import kotlin.comparisons.* import kotlin.comparisons.*
class MapJVMTest { class MapJVMTest {
@@ -2,7 +2,6 @@ package test.collections
import kotlin.test.* import kotlin.test.*
import test.* import test.*
import org.junit.Test
class MapTest { class MapTest {
@@ -2,7 +2,6 @@ package test.collections
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class MutableCollectionTest { class MutableCollectionTest {
fun <T, C: MutableCollection<T>> testOperation(before: List<T>, after: List<T>, expectedModified: Boolean, toMutableCollection: (List<T>) -> C) fun <T, C: MutableCollection<T>> testOperation(before: List<T>, after: List<T>, expectedModified: Boolean, toMutableCollection: (List<T>) -> C)
@@ -18,10 +18,7 @@ package test.collections
import test.collections.behaviors.listBehavior import test.collections.behaviors.listBehavior
import test.collections.compare import test.collections.compare
import kotlin.test.assertEquals import kotlin.test.*
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import org.junit.Test
class ReversedViewsTest { class ReversedViewsTest {
@@ -1,8 +1,7 @@
@file:kotlin.jvm.JvmVersion @file:kotlin.jvm.JvmVersion
package test.collections package test.collections
import org.junit.Test import kotlin.test.*
import kotlin.test.assertEquals
class SequenceJVMTest { class SequenceJVMTest {
@@ -16,7 +16,6 @@
package test.collections package test.collections
import org.junit.Test
import kotlin.test.* import kotlin.test.*
import kotlin.comparisons.* import kotlin.comparisons.*
@@ -1,7 +1,6 @@
package test.collections package test.collections
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class SetOperationsTest { class SetOperationsTest {
@Test fun distinct() { @Test fun distinct() {
@@ -4,7 +4,6 @@ package test.concurrent
import kotlin.concurrent.* import kotlin.concurrent.*
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import java.util.concurrent.* import java.util.concurrent.*
import java.util.concurrent.TimeUnit.* import java.util.concurrent.TimeUnit.*
@@ -7,7 +7,6 @@ import kotlin.test.*
import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicInteger
import java.util.Timer import java.util.Timer
import org.junit.Test
class TimerTest { class TimerTest {
@Test fun scheduledTask() { @Test fun scheduledTask() {
@@ -17,7 +17,6 @@
package test.coroutines package test.coroutines
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.*
class CoroutineContextTest { class CoroutineContextTest {
@@ -17,7 +17,6 @@
package test.coroutines package test.coroutines
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.*
/** /**
@@ -16,7 +16,6 @@
package test.coroutines package test.coroutines
import org.junit.Test
import kotlin.test.* import kotlin.test.*
import kotlin.coroutines.experimental.buildSequence import kotlin.coroutines.experimental.buildSequence
import kotlin.coroutines.experimental.buildIterator import kotlin.coroutines.experimental.buildIterator
@@ -1,7 +1,6 @@
@file:kotlin.jvm.JvmVersion @file:kotlin.jvm.JvmVersion
package test.io package test.io
import org.junit.Test
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.util.* import java.util.*
-1
View File
@@ -3,7 +3,6 @@ package test.io
import java.io.* import java.io.*
import java.util.* import java.util.*
import org.junit.Test
import kotlin.io.walkTopDown import kotlin.io.walkTopDown
import kotlin.test.* import kotlin.test.*
-1
View File
@@ -1,7 +1,6 @@
@file:kotlin.jvm.JvmVersion @file:kotlin.jvm.JvmVersion
package test.io package test.io
import org.junit.Test
import kotlin.test.* import kotlin.test.*
import java.io.Writer import java.io.Writer
import java.io.BufferedReader import java.io.BufferedReader
+1 -4
View File
@@ -1,15 +1,12 @@
@file:kotlin.jvm.JvmVersion @file:kotlin.jvm.JvmVersion
package test.io package test.io
import org.junit.Test import kotlin.test.*
import java.io.File import java.io.File
import kotlin.test.assertEquals
import java.io.Reader import java.io.Reader
import java.io.StringReader import java.io.StringReader
import java.net.URL import java.net.URL
import java.util.ArrayList import java.util.ArrayList
import kotlin.test.assertFalse
import kotlin.test.assertTrue
fun sample(): Reader = StringReader("Hello\nWorld"); fun sample(): Reader = StringReader("Hello\nWorld");
@@ -2,7 +2,6 @@
package test.io package test.io
import java.io.* import java.io.*
import org.junit.Test
import kotlin.test.* import kotlin.test.*
private class Serial(val name: String) : Serializable { private class Serial(val name: String) : Serializable {
-1
View File
@@ -16,7 +16,6 @@
package test.collections.js package test.collections.js
import org.junit.Test
import kotlin.test.* import kotlin.test.*
class JsArrayTest { class JsArrayTest {
@@ -2,7 +2,6 @@ package test.collections.js
import kotlin.test.* import kotlin.test.*
import kotlin.comparisons.* import kotlin.comparisons.*
import org.junit.Test
class JsCollectionsTest { class JsCollectionsTest {
val TEST_LIST = arrayOf(2, 0, 9, 7, 1).toList() val TEST_LIST = arrayOf(2, 0, 9, 7, 1).toList()
-1
View File
@@ -1,7 +1,6 @@
package test.collections.js package test.collections.js
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import test.collections.* import test.collections.*
import test.collections.behaviors.* import test.collections.behaviors.*
-1
View File
@@ -1,7 +1,6 @@
package test.collections.js package test.collections.js
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import test.collections.* import test.collections.*
import test.collections.behaviors.* import test.collections.behaviors.*
@@ -1,7 +1,6 @@
@file:kotlin.jvm.JvmVersion // TODO: Can't run in JS: spaces in function name KT-4160 @file:kotlin.jvm.JvmVersion // TODO: Can't run in JS: spaces in function name KT-4160
package test.language package test.language
import org.junit.Test
import kotlin.test.* import kotlin.test.*
class EscapedTestNamesTest { class EscapedTestNamesTest {
@@ -5,7 +5,6 @@ import java.math.BigInteger
import java.math.BigDecimal import java.math.BigDecimal
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import java.math.MathContext import java.math.MathContext
import java.math.RoundingMode import java.math.RoundingMode
@@ -1,7 +1,6 @@
package test.numbers package test.numbers
import kotlin.test.* import kotlin.test.*
import org.junit.Test
// TODO: Run these tests during compiler test only (JVM & JS) // TODO: Run these tests during compiler test only (JVM & JS)
class BitwiseOperationsTest { class BitwiseOperationsTest {
@@ -19,7 +19,6 @@ package test.numbers
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class CompanionIntrinsicObjectsJVMTest { class CompanionIntrinsicObjectsJVMTest {
@Test fun intTest() { @Test fun intTest() {
@@ -2,7 +2,6 @@
package test.numbers package test.numbers
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import kotlin.math.* import kotlin.math.*
class MathJVMTest { class MathJVMTest {
@@ -16,7 +16,6 @@
package test.numbers package test.numbers
import org.junit.Test
import kotlin.math.* import kotlin.math.*
import kotlin.test.* import kotlin.test.*
@@ -1,9 +1,7 @@
package numbers package numbers
import org.junit.Test import kotlin.test.*
import kotlin.test.assertTrue
import kotlin.comparisons.* import kotlin.comparisons.*
import kotlin.test.assertEquals
val Double.Companion.values get() = listOf(0.0, NEGATIVE_INFINITY, MIN_VALUE, MAX_VALUE, POSITIVE_INFINITY, NaN) val Double.Companion.values get() = listOf(0.0, NEGATIVE_INFINITY, MIN_VALUE, MAX_VALUE, POSITIVE_INFINITY, NaN)
val Float.Companion.values get() = listOf(0.0f, NEGATIVE_INFINITY, MIN_VALUE, MAX_VALUE, POSITIVE_INFINITY, NaN) val Float.Companion.values get() = listOf(0.0f, NEGATIVE_INFINITY, MIN_VALUE, MAX_VALUE, POSITIVE_INFINITY, NaN)
@@ -2,7 +2,6 @@
package test.numbers package test.numbers
import java.math.BigDecimal import java.math.BigDecimal
import org.junit.Test
import kotlin.test.* import kotlin.test.*
class NumbersJVMTest { class NumbersJVMTest {
@@ -1,6 +1,5 @@
package test.numbers package test.numbers
import org.junit.Test
import kotlin.test.* import kotlin.test.*
object NumbersTestConstants { object NumbersTestConstants {
@@ -1,6 +1,5 @@
package test.properties.delegation package test.properties.delegation
import org.junit.Test
import kotlin.test.* import kotlin.test.*
import kotlin.properties.* import kotlin.properties.*
@@ -1,7 +1,6 @@
package test.properties.delegation.map package test.properties.delegation.map
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class ValByMapExtensionsTest { class ValByMapExtensionsTest {
val map: Map<String, String> = hashMapOf("a" to "all", "b" to "bar", "c" to "code") val map: Map<String, String> = hashMapOf("a" to "all", "b" to "bar", "c" to "code")
@@ -1,6 +1,5 @@
package test.properties.delegation.lazy package test.properties.delegation.lazy
import org.junit.Test
import kotlin.properties.* import kotlin.properties.*
import kotlin.test.* import kotlin.test.*
@@ -1,6 +1,5 @@
package test.ranges package test.ranges
import org.junit.Test
import kotlin.test.* import kotlin.test.*
class CoercionTest { class CoercionTest {
@@ -1,8 +1,7 @@
package test.ranges package test.ranges
import org.junit.Test
import kotlin.comparisons.* import kotlin.comparisons.*
import kotlin.test.assertEquals import kotlin.test.*
class ProgressionLastElementTest { class ProgressionLastElementTest {
@@ -11,7 +11,6 @@ import java.lang.Long.MAX_VALUE as MaxL
import java.lang.Long.MIN_VALUE as MinL import java.lang.Long.MIN_VALUE as MinL
import java.lang.Character.MAX_VALUE as MaxC import java.lang.Character.MAX_VALUE as MaxC
import java.lang.Character.MIN_VALUE as MinC import java.lang.Character.MIN_VALUE as MinC
import org.junit.Test
import kotlin.test.* import kotlin.test.*
// Test data for codegen is generated from this class. If you change it, rerun GenerateTests // Test data for codegen is generated from this class. If you change it, rerun GenerateTests
@@ -1,6 +1,5 @@
package test.ranges package test.ranges
import org.junit.Test
import test.collections.behaviors.iteratorBehavior import test.collections.behaviors.iteratorBehavior
import test.collections.compare import test.collections.compare
import kotlin.test.* import kotlin.test.*
@@ -1,7 +1,6 @@
package test.ranges package test.ranges
import kotlin.test.* import kotlin.test.*
import org.junit.Test
public class RangeTest { public class RangeTest {
@Test fun intRange() { @Test fun intRange() {
@@ -3,7 +3,6 @@
package test.reflection package test.reflection
import kotlin.test.* import kotlin.test.*
import org.junit.Test
@Retention(AnnotationRetention.RUNTIME) @Retention(AnnotationRetention.RUNTIME)
annotation class MyAnno annotation class MyAnno
@@ -2,7 +2,6 @@
package test.text package test.text
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class CharJVMTest { class CharJVMTest {
@@ -18,7 +18,6 @@
package test.text package test.text
import kotlin.test.* import kotlin.test.*
import org.junit.Test
import test.collections.compare import test.collections.compare
import test.io.* import test.io.*
import java.util.regex.Pattern import java.util.regex.Pattern
-1
View File
@@ -3,7 +3,6 @@ package test.text
import kotlin.text.* import kotlin.text.*
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class RegexTest { class RegexTest {
@@ -2,7 +2,6 @@
package test.text package test.text
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class StringBuilderJVMTest() { class StringBuilderJVMTest() {
@@ -1,7 +1,6 @@
package test.text package test.text
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class StringBuilderTest { class StringBuilderTest {
@@ -5,7 +5,6 @@ import test.collections.assertArrayNotSameButEquals
import java.util.* import java.util.*
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class StringJVMTest { class StringJVMTest {
@@ -1,7 +1,6 @@
package test.text package test.text
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class StringNumberConversionTest { class StringNumberConversionTest {
-1
View File
@@ -18,7 +18,6 @@ package test.text
import kotlin.test.* import kotlin.test.*
import test.* import test.*
import org.junit.Test
import test.collections.behaviors.iteratorBehavior import test.collections.behaviors.iteratorBehavior
import test.collections.compare import test.collections.compare
@@ -1,6 +1,5 @@
package test.utils package test.utils
import org.junit.Test
import kotlin.test.* import kotlin.test.*
@@ -8,7 +8,6 @@ import java.io.*
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.atomic.AtomicInteger
import kotlin.concurrent.thread import kotlin.concurrent.thread
import org.junit.Test
import test.io.serializeAndDeserialize import test.io.serializeAndDeserialize
class LazyJVMTest { class LazyJVMTest {
-1
View File
@@ -2,7 +2,6 @@ package test.utils
import kotlin.* import kotlin.*
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class LazyTest { class LazyTest {
@@ -1,6 +1,5 @@
package test.utils package test.utils
import org.junit.Test
import kotlin.test.* import kotlin.test.*
class PreconditionsTest() { class PreconditionsTest() {
-1
View File
@@ -18,7 +18,6 @@ package test.utils
import kotlin.* import kotlin.*
import kotlin.test.* import kotlin.test.*
import org.junit.Test
class TODOTest { class TODOTest {
private class PartiallyImplementedClass { private class PartiallyImplementedClass {