Skip to content

Commit

Permalink
Escalate deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
twyatt committed Oct 5, 2023
1 parent 1064511 commit 8076734
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 173 deletions.
5 changes: 5 additions & 0 deletions encoding/src/commonMain/kotlin/Base64.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private fun CharSequence.decodeQuartet(index: Int): Int =
expression = "Base64.decode(this)",
imports = ["kotlin.io.encoding.Base64"],
),
level = DeprecationLevel.ERROR,
)
public fun CharSequence.decodeBase64(): ByteArray {
val numBytes = when {
Expand Down Expand Up @@ -78,6 +79,7 @@ public fun CharSequence.decodeBase64(): ByteArray {
expression = "Base64.decode(this).asSequence()",
imports = ["kotlin.io.encoding.Base64"],
),
level = DeprecationLevel.ERROR,
)
public fun CharSequence.decodeBase64Sequence(): Sequence<Byte> = sequence {
var index = 0
Expand Down Expand Up @@ -110,6 +112,7 @@ private fun Int.encode(): Char = when (this) {
expression = "Base64.encode(this)",
imports = ["kotlin.io.encoding.Base64"],
),
level = DeprecationLevel.ERROR,
)
public fun ByteArray.encodeBase64(): String = iterator().encodeBase64()

Expand All @@ -119,6 +122,7 @@ public fun ByteArray.encodeBase64(): String = iterator().encodeBase64()
expression = "Base64.encode(this.toList().toByteArray())",
imports = ["kotlin.io.encoding.Base64"],
),
level = DeprecationLevel.ERROR,
)
public fun Sequence<Byte>.encodeBase64(): String = iterator().encodeBase64()

Expand All @@ -128,6 +132,7 @@ public fun Sequence<Byte>.encodeBase64(): String = iterator().encodeBase64()
expression = "Base64.encode(this.toByteArray())",
imports = ["kotlin.io.encoding.Base64"],
),
level = DeprecationLevel.ERROR,
)
public fun Iterable<Byte>.encodeBase64(): String = iterator().encodeBase64()

Expand Down
2 changes: 2 additions & 0 deletions encoding/src/commonMain/kotlin/HexString.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package com.juul.tuulbox.encoding
"kotlin.text.HexFormat",
],
),
level = DeprecationLevel.ERROR,
)
public fun ByteArray.toHexString(
separator: String? = null,
Expand Down Expand Up @@ -45,6 +46,7 @@ public fun ByteArray.toHexString(
"kotlin.text.HexFormat",
],
),
level = DeprecationLevel.ERROR,
)
public fun CharSequence.parseHex(): ByteArray {
if (isEmpty()) return byteArrayOf()
Expand Down
71 changes: 0 additions & 71 deletions encoding/src/commonTest/kotlin/Base64Tests.kt

This file was deleted.

97 changes: 0 additions & 97 deletions encoding/src/commonTest/kotlin/HexStringTest.kt

This file was deleted.

1 change: 1 addition & 0 deletions logging-ktor-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ kotlin {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation(libs.ktor.mock)
implementation(libs.kotlinx.coroutines.test)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.juul.tuulbox.logging

import com.juul.tuulbox.test.runTest
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.engine.mock.MockEngine
import io.ktor.client.engine.mock.respond
import io.ktor.client.plugins.logging.LogLevel.ALL
import io.ktor.client.plugins.logging.Logging
import io.ktor.client.request.get
import kotlinx.coroutines.test.runTest
import kotlin.test.AfterTest
import kotlin.test.Test
import kotlin.test.assertTrue
Expand Down
5 changes: 4 additions & 1 deletion test/src/appleMain/kotlin/RunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import kotlinx.cinterop.memScoped
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.runBlocking

@Deprecated("Use official Coroutines `runTest`")
@Deprecated(
"Use official Coroutines `runTest`",
level = DeprecationLevel.ERROR,
)
public actual fun runTest(
action: suspend CoroutineScope.() -> Unit,
): Unit = runBlocking {
Expand Down
2 changes: 2 additions & 0 deletions test/src/commonMain/kotlin/Assert.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public fun assertSimilar(target: Long, epsilon: Long, value: Long) {
@Deprecated(
message = "Use assertEquals with tolerance (introduced in Kotlin 1.5). See https://kotlinlang.org/docs/whatsnew15.html#assertion-function-updates",
replaceWith = ReplaceWith("assertEquals(expected, value, epsilon)"),
level = DeprecationLevel.ERROR,
)
public fun assertSimilar(target: Float, epsilon: Float, value: Float) {
assertContains(target - epsilon..target + epsilon, value)
Expand All @@ -55,6 +56,7 @@ public fun assertSimilar(target: Float, epsilon: Float, value: Float) {
@Deprecated(
message = "Use assertEquals with tolerance (introduced in Kotlin 1.5). See https://kotlinlang.org/docs/whatsnew15.html#assertion-function-updates",
replaceWith = ReplaceWith("assertEquals(expected, value, epsilon)"),
level = DeprecationLevel.ERROR,
)
/** Asserts that [value] is equal to [target], plus or minus some [epsilon]. */
public fun assertSimilar(target: Double, epsilon: Double, value: Double) {
Expand Down
5 changes: 4 additions & 1 deletion test/src/commonMain/kotlin/RunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import kotlinx.coroutines.CoroutineScope
*
* Originally adapted from: https://github.com/Kotlin/kotlinx.coroutines/issues/885#issuecomment-446586161
*/
@Deprecated("Use official Coroutines `runTest`")
@Deprecated(
"Use official Coroutines `runTest`",
level = DeprecationLevel.ERROR,
)
public expect fun runTest(
action: suspend CoroutineScope.() -> Unit,
)
5 changes: 4 additions & 1 deletion test/src/jsMain/kotlin/RunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.promise

@Deprecated("Use official Coroutines `runTest`")
@Deprecated(
"Use official Coroutines `runTest`",
level = DeprecationLevel.ERROR,
)
public actual fun runTest(
action: suspend CoroutineScope.() -> Unit,
): dynamic = GlobalScope.promise { action.invoke(this) }
5 changes: 4 additions & 1 deletion test/src/jvmMain/kotlin/RunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ package com.juul.tuulbox.test
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.runBlocking

@Deprecated("Use official Coroutines `runTest`")
@Deprecated(
"Use official Coroutines `runTest`",
level = DeprecationLevel.ERROR,
)
public actual fun runTest(
action: suspend CoroutineScope.() -> Unit,
): Unit = runBlocking { action.invoke(this) }

0 comments on commit 8076734

Please sign in to comment.