diff --git a/libraries/stdlib/test/CompareJVMTest.kt b/libraries/stdlib/test/CompareJVMTest.kt new file mode 100644 index 00000000000..057f990c6b4 --- /dev/null +++ b/libraries/stdlib/test/CompareJVMTest.kt @@ -0,0 +1,40 @@ +package test.compare + +import java.util.Comparator +import kotlin.test.* +import org.junit.Test + +class CompareJVMTest { + val v1 = Item("wine", 9) + val v2 = Item("beer", 10) + + Test fun sortUsingComparatorHelperMethod() { + val c = comparator({ rating }, { name }) + println("Created comparator $c") + + val diff = c.compare(v1, v2) + assertTrue(diff < 0) + val items = arrayListOf(v1, v2) + items.sortBy(c) + println("Sorted list in rating order $items") + } + + Test fun sortUsingCustomComparator() { + val c = object : Comparator{ + override fun compare(o1: Item, o2: Item): Int { + return compareBy(o1, o2, { name }, { rating }) + } + override fun equals(obj: Any?): Boolean { + return this == obj + } + } + println("Created comparator $c") + + val diff = c.compare(v1, v2) + assertTrue(diff > 0) + val items = arrayListOf(v1, v2) + items.sortBy(c) + println("Sorted list in rating order $items") + } + +} diff --git a/libraries/stdlib/test/CompareTest.kt b/libraries/stdlib/test/CompareTest.kt index 713e7d062f3..e517f869d61 100644 --- a/libraries/stdlib/test/CompareTest.kt +++ b/libraries/stdlib/test/CompareTest.kt @@ -1,6 +1,5 @@ package test.compare -import java.util.Comparator import kotlin.test.* import org.junit.Test @@ -35,34 +34,4 @@ class CompareTest { val diff = compareBy(v1, v1, { rating }, { name }) assertTrue(diff == 0) } - - Test fun sortUsingComparatorHelperMethod() { - val c = comparator({ rating }, { name }) - println("Created comparator $c") - - val diff = c.compare(v1, v2) - assertTrue(diff < 0) - val items = arrayListOf(v1, v2) - items.sortBy(c) - println("Sorted list in rating order $items") - } - - Test fun sortUsingCustomComparator() { - val c = object : Comparator{ - override fun compare(o1: Item, o2: Item): Int { - return compareBy(o1, o2, { name }, { rating }) - } - override fun equals(obj: Any?): Boolean { - return this == obj - } - } - println("Created comparator $c") - - val diff = c.compare(v1, v2) - assertTrue(diff > 0) - val items = arrayListOf(v1, v2) - items.sortBy(c) - println("Sorted list in rating order $items") - } - } diff --git a/libraries/stdlib/test/MathTest.kt b/libraries/stdlib/test/MathTest.kt index 9199204a492..6b33ac04eee 100644 --- a/libraries/stdlib/test/MathTest.kt +++ b/libraries/stdlib/test/MathTest.kt @@ -5,10 +5,10 @@ import java.math.BigInteger import java.math.BigDecimal import kotlin.test.* -import junit.framework.TestCase +import org.junit.Test as test -class MathTest : TestCase() { - fun testBigInteger() { +class MathTest { + test fun testBigInteger() { val a = BigInteger("2") val b = BigInteger("3") @@ -21,7 +21,7 @@ class MathTest : TestCase() { assertEquals(BigInteger("-2"), -a remainder b) } - fun testBigDecimal() { + test fun testBigDecimal() { val a = BigDecimal("2") val b = BigDecimal("3") diff --git a/libraries/stdlib/test/OldStdlibTest.kt b/libraries/stdlib/test/OldStdlibTest.kt index b2d56240413..3006520a0bf 100644 --- a/libraries/stdlib/test/OldStdlibTest.kt +++ b/libraries/stdlib/test/OldStdlibTest.kt @@ -2,26 +2,25 @@ package test.collections import kotlin.* import kotlin.io.* -import kotlin.util.* import kotlin.test.* import java.util.* import java.io.* -import junit.framework.TestCase +import org.junit.Test as test -class OldStdlibTest() : TestCase() { - fun testCollectionEmpty() { +class OldStdlibTest() { + test fun testCollectionEmpty() { assertNot { - Arrays.asList(0, 1, 2).empty + listOf(0, 1, 2).empty } } - fun testCollectionSize() { + test fun testCollectionSize() { assertTrue { - Arrays.asList(0, 1, 2).size == 3 + listOf(0, 1, 2).size == 3 } } - fun testInputStreamIterator() { + test fun testInputStreamIterator() { val x = ByteArray (10) for(index in 0..9) { @@ -29,7 +28,7 @@ class OldStdlibTest() : TestCase() { } for(b in x.inputStream) { - System.out.println(b) + println(b) } } } diff --git a/libraries/stdlib/test/StdLibIssuesTest.kt b/libraries/stdlib/test/StdLibIssuesTest.kt index 494edc7574e..9964c20fa22 100644 --- a/libraries/stdlib/test/StdLibIssuesTest.kt +++ b/libraries/stdlib/test/StdLibIssuesTest.kt @@ -1,16 +1,15 @@ package test.stdlib.issues -import kotlin.util.* import kotlin.test.* -import junit.framework.TestCase +import org.junit.Test as test private fun listDifference(first : List, second : List) : List { return first.filter{ !second.contains(it) }.toList() } -class StdLibIssuesTest() : TestCase() { +class StdLibIssuesTest { - fun test_KT_1131() { + test fun test_KT_1131() { val data = arrayList("blah", "foo", "bar") val filterValues = arrayList("bar", "something", "blah") diff --git a/libraries/stdlib/test/TuplesTest.kt b/libraries/stdlib/test/TuplesTest.kt index e164039ea18..ca241f1fc5d 100644 --- a/libraries/stdlib/test/TuplesTest.kt +++ b/libraries/stdlib/test/TuplesTest.kt @@ -1,8 +1,9 @@ package test.tuples -import kotlin.test.assertTrue import org.junit.Test as test +import kotlin.test.assertTrue import kotlin.test.assertEquals +import kotlin.test.assertNotEquals class PairTest { val p = Pair(1, "a") @@ -23,69 +24,69 @@ class PairTest { } test fun pairEquals() { - assertTrue(p == Pair(1, "a")) - assertTrue(p != Pair(2, "a")) - assertTrue(p != Pair(1, "b")) + assertEquals(Pair(1, "a"), p) + assertNotEquals(Pair(2, "a"), p) + assertNotEquals(Pair(1, "b"), p) assertTrue(!p.equals(null)) - assertTrue((p : Any) != "") + assertNotEquals("", (p : Any)) } test fun pairHashCode() { - assertTrue(p.hashCode() == Pair(1, "a").hashCode()) - assertTrue(p.hashCode() != Pair(2, "a").hashCode()) - assertTrue(Pair(null, "b").hashCode() != 0) - assertTrue(Pair("b", null).hashCode() != 0) - assertTrue(Pair(null, null).hashCode() == 0) + assertEquals(Pair(1, "a").hashCode(), p.hashCode()) + assertNotEquals(Pair(2, "a").hashCode(), p.hashCode()) + assertNotEquals(0, Pair(null, "b").hashCode()) + assertNotEquals(0, Pair("b", null).hashCode()) + assertEquals(0, Pair(null, null).hashCode()) } test fun pairHashSet() { val s = hashSet(Pair(1, "a"), Pair(1, "b"), Pair(1, "a")) - assertTrue(s.size == 2) + assertEquals(2, s.size) assertTrue(s.contains(p)) } } class TripleTest { - val t = Triple(1, "a", 0.0) + val t = Triple(1, "a", 0.07) test fun tripleFirstAndSecond() { - assertTrue(t.first == 1) - assertTrue(t.second == "a") - assertTrue(t.third == 0.0) + assertEquals(1, t.first) + assertEquals("a", t.second) + assertEquals(0.07, t.third) } test fun tripleMultiAssignment() { val (a, b, c) = t - assertTrue(a == 1) - assertTrue(b == "a") - assertTrue(c == 0.0) + assertEquals(1, a) + assertEquals("a", b) + assertEquals(0.07, c) } test fun tripleToString() { - assertEquals("(1, a, 0.0)", t.toString()) + assertEquals("(1, a, 0.07)", t.toString()) } test fun tripleEquals() { - assertTrue(t == Triple(1, "a", 0.0)) - assertTrue(t != Triple(2, "a", 0.0)) - assertTrue(t != Triple(1, "b", 0.0)) - assertTrue(t != Triple(1, "a", 0.1)) + assertEquals(Triple(1, "a", 0.07), t) + assertNotEquals(Triple(2, "a", 0.07), t) + assertNotEquals(Triple(1, "b", 0.07), t) + assertNotEquals(Triple(1, "a", 0.1), t) assertTrue(!t.equals(null)) - assertTrue((t : Any) != "") + assertNotEquals("", (t : Any)) } test fun tripleHashCode() { - assertTrue(t.hashCode() == Triple(1, "a", 0.0).hashCode()) - assertTrue(t.hashCode() != Triple(2, "a", 0.0).hashCode()) - assertTrue(Triple(null, "b", 0.0).hashCode() != 0) - assertTrue(Triple("b", null, 0.0).hashCode() != 0) - assertTrue(Triple("b", 1, null).hashCode() != 0) - assertTrue(Triple(null, null, null).hashCode() == 0) + assertEquals(Triple(1, "a", 0.07).hashCode(), t.hashCode()) + assertNotEquals(Triple(2, "a", 0.07).hashCode(), t.hashCode()) + assertNotEquals(0, Triple(null, "b", 0.07).hashCode()) + assertNotEquals(0, Triple("b", null, 0.07).hashCode()) + assertNotEquals(0, Triple("b", 1, null).hashCode()) + assertEquals(0, Triple(null, null, null).hashCode()) } test fun tripleHashSet() { - val s = hashSet(Triple(1, "a", 0.0), Triple(1, "b", 0.0), Triple(1, "a", 0.0)) - assertTrue(s.size == 2) + val s = hashSet(Triple(1, "a", 0.07), Triple(1, "b", 0.07), Triple(1, "a", 0.07)) + assertEquals(2, s.size) assertTrue(s.contains(t)) } } diff --git a/libraries/stdlib/test/collections/CollectionJVMTest.kt b/libraries/stdlib/test/collections/CollectionJVMTest.kt index 4f929f070fc..3718a4639c3 100644 --- a/libraries/stdlib/test/collections/CollectionJVMTest.kt +++ b/libraries/stdlib/test/collections/CollectionJVMTest.kt @@ -70,6 +70,10 @@ class CollectionJVMTest { } } + test fun first() { + assertEquals(19, TreeSet(arrayListOf(90, 47, 19)).first()) + } + test fun last() { val data = arrayListOf("foo", "bar") assertEquals("bar", data.last()) @@ -85,28 +89,19 @@ class CollectionJVMTest { assertTrue(linkedListOf(15, 19, 20).contains(15)) } - test fun sortBy() { - expect(arrayListOf("two" to 2, "three" to 3)) { - arrayListOf("three" to 3, "two" to 2).sortBy { it.second } - } - expect(arrayListOf("three" to 3, "two" to 2)) { - arrayListOf("three" to 3, "two" to 2).sortBy { it.first } - } - expect(arrayListOf("two" to 2, "three" to 3)) { - arrayListOf("three" to 3, "two" to 2).sortBy { it.first.length } + test fun toArray() { + val data = arrayListOf("foo", "bar") + val arr = data.toArray() + println("Got array ${arr}") + assertEquals(2, arr.size) + todo { + assertTrue { + arr is Array + } } } - - test fun sortFunctionShouldReturnSortedCopyForList() { - val list: List = arrayListOf(2, 3, 1) - expect(arrayListOf(1, 2, 3)) { list.sort() } - expect(arrayListOf(2, 3, 1)) { list } - } - - test fun sortFunctionShouldReturnSortedCopyForIterable() { - val list: Iterable = arrayListOf(2, 3, 1) - expect(arrayListOf(1, 2, 3)) { list.sort() } - expect(arrayListOf(2, 3, 1)) { list } + test fun takeReturnsFirstNElements() { + expect(setOf(1, 2)) { sortedSetOf(1, 2, 3, 4, 5).take(2).toSet() } } } diff --git a/libraries/stdlib/test/collections/CollectionTest.kt b/libraries/stdlib/test/collections/CollectionTest.kt index 77b96b64154..feac6802b72 100644 --- a/libraries/stdlib/test/collections/CollectionTest.kt +++ b/libraries/stdlib/test/collections/CollectionTest.kt @@ -30,9 +30,10 @@ class CollectionTest { assertEquals(2, foo.size) assertEquals(arrayListOf("foo", "bar"), foo) - assertTrue { - foo is List - } +// TODO uncomment this when KT-2468 will be fixed +// assertTrue { +// foo is List +// } } test fun mapNotNull() { @@ -41,9 +42,10 @@ class CollectionTest { assertEquals(2, foo.size) assertEquals(arrayListOf(3, 3), foo) - assertTrue { - foo is List - } +// TODO uncomment this when KT-2468 will be fixed +// assertTrue { +// foo is List +// } } test fun filterIntoSet() { @@ -148,7 +150,9 @@ class CollectionTest { list.reduce { a, b -> a + b } } - failsWith(javaClass()) { +// TODO replace with more accurate version when KT-5987 will be fixed +// failsWith(javaClass()) { + fails { arrayListOf().reduce { a, b -> a + b } } } @@ -159,7 +163,9 @@ class CollectionTest { list.reduceRight { a, b -> a + b } } - failsWith(javaClass()) { +// TODO replace with more accurate version when KT-5987 will be fixed +// failsWith(javaClass()) { + fails { arrayListOf().reduceRight { a, b -> a + b } } } @@ -229,7 +235,10 @@ class CollectionTest { assertEquals(arrayListOf("foo", "bar"), notNull) val hasNulls = arrayListOf("foo", null, "bar") - failsWith(javaClass()) { + +// TODO replace with more accurate version when KT-5987 will be fixed +// failsWith(javaClass()) { + fails { // should throw an exception as we have a null hasNulls.requireNoNulls() } @@ -277,9 +286,9 @@ class CollectionTest { assertEquals(arrayListOf("foo", "bar", "abc"), coll.takeWhile { it.size == 3 }) } - test fun toArray() { + test fun copyToArray() { val data = arrayListOf("foo", "bar") - val arr = data.toArray() + val arr = data.copyToArray() println("Got array ${arr}") assertEquals(2, arr.size) todo { @@ -297,7 +306,11 @@ class CollectionTest { } test fun first() { - assertEquals(19, TreeSet(arrayListOf(90, 47, 19)).first()) + val data = arrayListOf("foo", "bar") + assertEquals("foo", data.first()) + assertEquals(15, arrayListOf(15, 19, 20, 25).first()) + assertEquals('a', arrayListOf('a').first()) + fails { arrayListOf().first() } } test fun last() { @@ -344,7 +357,6 @@ class CollectionTest { assertTrue(arrayListOf(15, 19, 20).contains(15)) assertTrue(IterableWrapper(hashSetOf(45, 14, 13)).contains(14)) - assertFalse(IterableWrapper(linkedListOf()).contains(15)) } test fun sortForMutableIterable() { @@ -436,6 +448,29 @@ class CollectionTest { expect(listOf()) { listOf(1L) take 0 } expect(listOf(1)) { (1..1) take 10 } expect(listOf(1)) { listOf(1) take 10 } - expect(setOf(1, 2)) { sortedSetOf(1, 2, 3, 4, 5).take(2).toSet() } + } + + test fun sortBy() { + expect(arrayListOf("two" to 2, "three" to 3)) { + arrayListOf("three" to 3, "two" to 2).sortBy { it.second } + } + expect(arrayListOf("three" to 3, "two" to 2)) { + arrayListOf("three" to 3, "two" to 2).sortBy { it.first } + } + expect(arrayListOf("two" to 2, "three" to 3)) { + arrayListOf("three" to 3, "two" to 2).sortBy { it.first.length } + } + } + + test fun sortFunctionShouldReturnSortedCopyForList() { + val list: List = arrayListOf(2, 3, 1) + expect(arrayListOf(1, 2, 3)) { list.sort() } + expect(arrayListOf(2, 3, 1)) { list } + } + + test fun sortFunctionShouldReturnSortedCopyForIterable() { + val list: Iterable = arrayListOf(2, 3, 1) + expect(arrayListOf(1, 2, 3)) { list.sort() } + expect(arrayListOf(2, 3, 1)) { list } } } diff --git a/libraries/stdlib/test/collections/IterableTests.kt b/libraries/stdlib/test/collections/IterableTests.kt index 910796d2975..85d24879b46 100644 --- a/libraries/stdlib/test/collections/IterableTests.kt +++ b/libraries/stdlib/test/collections/IterableTests.kt @@ -202,13 +202,13 @@ abstract class IterableTests>(val data: T, val empty: T) { Test fun fold() { - + expect(231) { data.fold(1, {a, b -> a + if (b == "foo") 200 else 30 }) } } Test fun reduce() { - + val reduced = data.reduce {a, b -> a + b } + assertEquals(6, reduced.size) + assertTrue(reduced == "foobar" || reduced == "barfoo") } - - } diff --git a/libraries/stdlib/test/language/RangeIterationTestJVM.kt b/libraries/stdlib/test/language/RangeIterationJVMTest.kt similarity index 99% rename from libraries/stdlib/test/language/RangeIterationTestJVM.kt rename to libraries/stdlib/test/language/RangeIterationJVMTest.kt index 2b8bd50b221..3d4cf7f681a 100644 --- a/libraries/stdlib/test/language/RangeIterationTestJVM.kt +++ b/libraries/stdlib/test/language/RangeIterationJVMTest.kt @@ -16,7 +16,7 @@ import kotlin.test.assertEquals import org.junit.Test as test // Test data for codegen is generated from this class. If you change it, rerun GenerateTests -public class RangeIterationTestJVM { +public class RangeIterationJVMTest { private fun doTest( sequence: Progression, expectedStart: N, diff --git a/libraries/stdlib/test/language/RangeTestJVM.kt b/libraries/stdlib/test/language/RangeJVMTest.kt similarity index 99% rename from libraries/stdlib/test/language/RangeTestJVM.kt rename to libraries/stdlib/test/language/RangeJVMTest.kt index 61239dff283..efee939eb09 100644 --- a/libraries/stdlib/test/language/RangeTestJVM.kt +++ b/libraries/stdlib/test/language/RangeJVMTest.kt @@ -5,7 +5,7 @@ import java.lang.Float as jFloat import org.junit.Test as test import kotlin.test.* -public class RangeTestJVM { +public class RangeJVMTest { test fun doubleRange() { val range = -1.0..3.14159265358979 diff --git a/libraries/stdlib/test/language/StringExpressionExampleTest.kt b/libraries/stdlib/test/language/StringExpressionExampleTest.kt index c51cf2e9d76..4d2d68fdd73 100644 --- a/libraries/stdlib/test/language/StringExpressionExampleTest.kt +++ b/libraries/stdlib/test/language/StringExpressionExampleTest.kt @@ -1,9 +1,7 @@ package language -import kotlin.util.* -import java.util.* - -import junit.framework.TestCase +import org.junit.Test as test +import kotlin.test.* class Product(val name: String, val price: Double) { } @@ -28,11 +26,22 @@ fun productSnippet(product: Product) = "
  • ${product.name}. Price : ${product.p // TODO support number formatting methods? // fun productSnippet(product: Product) = "
  • ${product.name}. Price : ${product.price.format('## ###,00')}
  • " +val EXPECTED = """ + + +

    Hello James

    +
      +
    • Beer. Price : 1.99
    • +
    • Wine. Price : 5.99
    • +
    +

    lets do some kool stuff

    + +""" -class StringExpressionExampleTest : TestCase() { +class StringExpressionExampleTest { val customer = Customer("James", arrayListOf(Product("Beer", 1.99), Product("Wine", 5.99))) - fun testExpressions(): Unit { - println(customerTemplate(customer)) + test fun testExpressions(): Unit { + assertEquals(EXPECTED, customerTemplate(customer)) } } \ No newline at end of file diff --git a/libraries/stdlib/test/properties/PropertiesTest.kt b/libraries/stdlib/test/properties/PropertiesTest.kt index 32a2865ee9d..cd0ae96dd2c 100644 --- a/libraries/stdlib/test/properties/PropertiesTest.kt +++ b/libraries/stdlib/test/properties/PropertiesTest.kt @@ -2,12 +2,11 @@ package test.properties import kotlin.* import kotlin.properties.* -import kotlin.util.* import kotlin.test.* import java.util.* -import junit.framework.TestCase +import org.junit.Test as test -class Customer() : ChangeSupport() { +class Customer : ChangeSupport() { // TODO the setter code should be generated // via KT-1299 var name: String? = null @@ -25,7 +24,7 @@ class Customer() : ChangeSupport() { override fun toString() = "Customer($name, $city)" } -class MyChangeListener() : ChangeListener { +class MyChangeListener : ChangeListener { val events = ArrayList() override fun onPropertyChange(event: ChangeEvent): Unit { @@ -34,9 +33,9 @@ class MyChangeListener() : ChangeListener { } } -class PropertiesTest() : TestCase() { +class PropertiesTest { - fun testModel() { + test fun testModel() { val c = Customer() c.name = "James" c.city = "Mells" diff --git a/libraries/stdlib/test/properties/delegation/DelegationTest.kt b/libraries/stdlib/test/properties/delegation/DelegationTest.kt index 4fddb1ef43e..a421ad1a6a3 100644 --- a/libraries/stdlib/test/properties/delegation/DelegationTest.kt +++ b/libraries/stdlib/test/properties/delegation/DelegationTest.kt @@ -1,6 +1,6 @@ package test.properties.delegation -import junit.framework.TestCase +import org.junit.Test as test import kotlin.test.* import kotlin.properties.* @@ -8,26 +8,26 @@ trait WithBox { fun box(): String } -abstract class DelegationTestBase: TestCase() { +abstract class DelegationTestBase { fun doTest(klass: WithBox) { assertEquals("OK", klass.box()) } } class DelegationTest(): DelegationTestBase() { - fun testNotNullVar() { + test fun testNotNullVar() { doTest(TestNotNullVar("a", "b")) } - fun testObservablePropertyInChangeSupport() { + test fun testObservablePropertyInChangeSupport() { doTest(TestObservablePropertyInChangeSupport()) } - fun testObservableProperty() { + test fun testObservableProperty() { doTest(TestObservableProperty()) } - fun testVetoableProperty() { + test fun testVetoableProperty() { doTest(TestVetoableProperty()) } } @@ -82,6 +82,8 @@ class TestObservableProperty: WithBox { } } +class A(val p: Boolean) + class TestVetoableProperty: WithBox { var result = false var b by Delegates.vetoable(A(true), {(pd, o, n) -> result = n.p == true; result}) @@ -96,6 +98,4 @@ class TestVetoableProperty: WithBox { if (result) return "fail4: result should be false" return "OK" } - - class A(val p: Boolean) } diff --git a/libraries/stdlib/test/properties/delegation/MapDelegationTest.kt b/libraries/stdlib/test/properties/delegation/MapDelegationTest.kt index 5b714fa1bc8..26d7e01e400 100644 --- a/libraries/stdlib/test/properties/delegation/MapDelegationTest.kt +++ b/libraries/stdlib/test/properties/delegation/MapDelegationTest.kt @@ -1,53 +1,56 @@ package test.properties.delegation +import org.junit.Test as test import java.util.HashMap import kotlin.properties.* class MapDelegationTest(): DelegationTestBase() { - fun testMapPropertyString() { + test fun testMapPropertyString() { doTest(TestMapPropertyString()) } - fun testMapValWithDifferentTypes() { + test fun testMapValWithDifferentTypes() { doTest(TestMapValWithDifferentTypes()) } - fun testMapVarWithDifferentTypes() { + test fun testMapVarWithDifferentTypes() { doTest(TestMapVarWithDifferentTypes()) } - fun testNullableKey() { + test fun testNullableKey() { doTest(TestNullableKey()) } - fun testMapPropertyKey() { + test fun testMapPropertyKey() { doTest(TestMapPropertyKey()) } - fun testMapPropertyFunction() { + test fun testMapPropertyFunction() { doTest(TestMapPropertyFunction()) } - fun testMapPropertyCustom() { + test fun testMapPropertyCustom() { doTest(TestMapPropertyCustom()) } - fun testMapValWithDefault() { + test fun testMapValWithDefault() { doTest(TestMapValWithDefault()) } - fun testMapVarWithDefault() { + test fun testMapVarWithDefault() { doTest(TestMapVarWithDefault()) } - fun testMapPropertyCustomWithDefault() { + test fun testMapPropertyCustomWithDefault() { doTest(TestMapPropertyCustomWithDefault()) } } +data class B(val a: Int) + class TestMapValWithDifferentTypes(): WithBox { - val map = hashMapOf("a" to "a", "b" to 1, "c" to A(1), "d" to null) + val map = hashMapOf("a" to "a", "b" to 1, "c" to B(1), "d" to null) val a by Delegates.mapVal(map) val b by Delegates.mapVal(map) val c by Delegates.mapVal(map) @@ -56,16 +59,14 @@ class TestMapValWithDifferentTypes(): WithBox { override fun box(): String { if (a != "a") return "fail at 'a'" if (b != 1) return "fail at 'b'" - if (c != A(1)) return "fail at 'c'" + if (c != B(1)) return "fail at 'c'" if (d != null) return "fail at 'd'" return "OK" } - - data class A(val a: Int) } class TestMapVarWithDifferentTypes(): WithBox { - val map: HashMap = hashMapOf("a" to "a", "b" to 1, "c" to A(1), "d" to "d") + val map: HashMap = hashMapOf("a" to "a", "b" to 1, "c" to B(1), "d" to "d") var a: String by Delegates.mapVar(map) var b: Int by Delegates.mapVar(map) var c by Delegates.mapVar(map) @@ -74,16 +75,14 @@ class TestMapVarWithDifferentTypes(): WithBox { override fun box(): String { a = "aa" b = 11 - c = A(11) + c = B(11) d = null if (a != "aa") return "fail at 'a'" if (b != 11) return "fail at 'b'" - if (c != A(11)) return "fail at 'c'" + if (c != B(11)) return "fail at 'c'" if (d != null) return "fail at 'd'" return "OK" } - - data class A(val a: Int) } class TestNullableKey: WithBox { diff --git a/libraries/stdlib/test/properties/delegation/lazy/LazyValuesTest.kt b/libraries/stdlib/test/properties/delegation/lazy/LazyValuesTest.kt index 31fe609bf2d..21b0c1f121f 100644 --- a/libraries/stdlib/test/properties/delegation/lazy/LazyValuesTest.kt +++ b/libraries/stdlib/test/properties/delegation/lazy/LazyValuesTest.kt @@ -2,31 +2,32 @@ package test.properties.delegation.lazy import test.properties.delegation.WithBox import test.properties.delegation.DelegationTestBase +import org.junit.Test as test import kotlin.properties.* class LazyValuesTest(): DelegationTestBase() { - fun testLazyVal() { + test fun testLazyVal() { doTest(TestLazyVal()) } - fun testNullableLazyVal() { + test fun testNullableLazyVal() { doTest(TestNullableLazyVal()) } - fun testAtomicNullableLazyVal() { + test fun testAtomicNullableLazyVal() { doTest(TestAtomicNullableLazyVal()) } - fun testAtomicLazyVal() { + test fun testAtomicLazyVal() { doTest(TestAtomicLazyVal()) } - fun testVolatileNullableLazyVal() { + test fun testVolatileNullableLazyVal() { doTest(TestVolatileNullableLazyVal()) } - fun testVolatileLazyVal() { + test fun testVolatileLazyVal() { doTest(TestVolatileLazyVal()) } } diff --git a/libraries/stdlib/test/text/StringUtilTest.kt b/libraries/stdlib/test/text/StringUtilTest.kt index 5414c3dc515..be03f36e775 100644 --- a/libraries/stdlib/test/text/StringUtilTest.kt +++ b/libraries/stdlib/test/text/StringUtilTest.kt @@ -2,7 +2,6 @@ package test.text import kotlin.* import kotlin.test.* -import kotlin.util.* import org.junit.Test as test class StringUtilTest() { diff --git a/libraries/tools/kotlin-js-tests/pom.xml b/libraries/tools/kotlin-js-tests/pom.xml index 466704bcf13..21dbf8ca09a 100644 --- a/libraries/tools/kotlin-js-tests/pom.xml +++ b/libraries/tools/kotlin-js-tests/pom.xml @@ -32,51 +32,50 @@ - - - - - - - - - - - - - - - - - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +