Skip to content

Commit

Permalink
Ignore file based tests on Apple Simulators
Browse files Browse the repository at this point in the history
  • Loading branch information
schlaubi authored and schlaubi committed Jan 29, 2024
1 parent 7edf18d commit c68a078
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/src/commonTest/kotlin/json/ChannelTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dev.kord.common.json
import dev.kord.common.entity.DiscordChannel
import dev.kord.common.entity.optional.value
import dev.kord.common.readFile
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.serialization.json.Json
import kotlin.js.JsName
Expand All @@ -11,6 +12,7 @@ import kotlin.test.Test

private suspend fun file(name: String): String = readFile("channel", name)

@IgnoreOnSimulatorPlatforms
class ChannelTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions common/src/commonTest/kotlin/json/EmojiTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package dev.kord.common.json
import dev.kord.common.entity.DiscordEmoji
import dev.kord.common.entity.Snowflake
import dev.kord.common.readFile
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.serialization.json.Json
import kotlin.js.JsName
import kotlin.test.Test

private suspend fun file(name: String): String = readFile("emoji", name)

@IgnoreOnSimulatorPlatforms
class EmojiTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions common/src/commonTest/kotlin/json/GuildTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dev.kord.common.json
import dev.kord.common.entity.*
import dev.kord.common.entity.Permission.*
import dev.kord.common.readFile
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Instant
import kotlinx.serialization.json.Json
Expand All @@ -12,6 +13,7 @@ import kotlin.time.Duration.Companion.seconds

private suspend fun file(name: String): String = readFile("guild", name)

@IgnoreOnSimulatorPlatforms
class GuildTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions common/src/commonTest/kotlin/json/InteractionTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dev.kord.common.entity.*
import dev.kord.common.entity.Permission.*
import dev.kord.common.entity.optional.orEmpty
import dev.kord.common.readFile
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.serialization.json.Json
import kotlin.js.JsName
Expand All @@ -20,6 +21,7 @@ private val perms = Permissions(
ManageGuildExpressions,
)

@IgnoreOnSimulatorPlatforms
class InteractionTest {

val json = Json {
Expand Down
2 changes: 2 additions & 0 deletions common/src/commonTest/kotlin/json/MessageTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dev.kord.common.json

import dev.kord.common.entity.*
import dev.kord.common.readFile
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Instant
import kotlinx.serialization.json.Json
Expand All @@ -10,6 +11,7 @@ import kotlin.test.Test

private suspend fun file(name: String): String = readFile("message", name)

@IgnoreOnSimulatorPlatforms
class MessageTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions common/src/commonTest/kotlin/json/PermissionsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package dev.kord.common.json
import dev.kord.common.entity.DiscordRole
import dev.kord.common.entity.Permission
import dev.kord.common.entity.Permissions
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.put
import kotlin.js.JsName
import kotlin.test.Test
import kotlin.test.assertEquals

@IgnoreOnSimulatorPlatforms
class PermissionsTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions common/src/commonTest/kotlin/json/UserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import dev.kord.common.entity.DiscordUser
import dev.kord.common.entity.UserFlag.HouseBravery
import dev.kord.common.entity.UserFlags
import dev.kord.common.readFile
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.serialization.json.Json
import kotlin.js.JsName
import kotlin.test.Test

private suspend fun file(name: String): String = readFile("user", name)

@IgnoreOnSimulatorPlatforms
class UserTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions common/src/commonTest/kotlin/json/VoiceStateTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dev.kord.common.json

import dev.kord.common.entity.DiscordVoiceState
import dev.kord.common.readFile
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Instant
import kotlinx.serialization.json.Json
Expand All @@ -10,6 +11,7 @@ import kotlin.test.Test

private suspend fun file(name: String): String = readFile("voice", name)

@IgnoreOnSimulatorPlatforms
class VoiceStateTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions gateway/src/commonTest/kotlin/json/CommandTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import dev.kord.common.entity.optional.coerceToMissing
import dev.kord.common.entity.optional.optional
import dev.kord.common.entity.optional.optionalInt
import dev.kord.gateway.*
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.datetime.Instant
import kotlinx.serialization.json.*
import kotlin.js.JsName
Expand All @@ -17,6 +18,7 @@ import kotlin.test.assertEquals

private val json = Json { encodeDefaults = false }

@IgnoreOnSimulatorPlatforms
class CommandTest {
@Test
@JsName("test1")
Expand Down
2 changes: 2 additions & 0 deletions gateway/src/commonTest/kotlin/json/RegressionTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package dev.kord.gateway.json

import dev.kord.gateway.Event
import dev.kord.gateway.Reconnect
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.serialization.json.Json
import kotlin.js.JsName
import kotlin.test.Test

private suspend fun file(name: String): String = readFile("regression", name)

@IgnoreOnSimulatorPlatforms
class RegressionTests {
@Test
@JsName("test1")
Expand Down
2 changes: 2 additions & 0 deletions gateway/src/commonTest/kotlin/json/SerializationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dev.kord.common.entity.UserPremium
import dev.kord.common.entity.optional.Optional
import dev.kord.common.entity.optional.value
import dev.kord.gateway.*
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Instant
import kotlinx.serialization.json.Json
Expand All @@ -15,6 +16,7 @@ import kotlin.time.Duration.Companion.seconds

private suspend fun file(name: String): String = readFile("event", name)

@IgnoreOnSimulatorPlatforms
class SerializationTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions gateway/src/commonTest/kotlin/json/SnowflakeTest.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.kord.gateway.json

import dev.kord.common.entity.Snowflake
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
Expand All @@ -9,6 +10,7 @@ import kotlin.js.JsName
import kotlin.test.Test
import kotlin.test.assertEquals

@IgnoreOnSimulatorPlatforms
class SnowflakeTest {

@Serializable
Expand Down
2 changes: 2 additions & 0 deletions rest/src/commonTest/kotlin/json/AuditLogResponseTest.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package dev.kord.rest.json

import dev.kord.common.entity.DiscordAuditLog
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.serialization.json.Json
import kotlin.js.JsName
import kotlin.test.Test

@IgnoreOnSimulatorPlatforms
class AuditLogResponseTest {

@Test
Expand Down
2 changes: 2 additions & 0 deletions rest/src/commonTest/kotlin/json/ErrorTest.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package dev.kord.rest.json

import dev.kord.rest.json.response.DiscordErrorResponse
import dev.kord.test.IgnoreOnSimulatorPlatforms
import kotlinx.coroutines.test.runTest
import kotlinx.serialization.json.Json
import kotlin.js.JsName
import kotlin.test.Test
import kotlin.test.assertEquals

@IgnoreOnSimulatorPlatforms
class ErrorTest {
private val parser = Json {
encodeDefaults = false
Expand Down
12 changes: 12 additions & 0 deletions test-kit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
`kord-native-module`
`kord-internal-multiplatform-module`
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
kotlin {
applyDefaultHierarchyTemplate {
common {
group("simulator") {
withIos()
withTvos()
withWasm()
}
}
}
sourceSets {
commonMain {
dependencies {
Expand Down
5 changes: 5 additions & 0 deletions test-kit/src/commonMain/kotlin/Annotations.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ expect annotation class IgnoreOnJvm()
@Target(CLASS, FUNCTION)
@OptionalExpectation
expect annotation class IgnoreOnNative()

/** Ignores this test on simulator platforms. */
@Target(CLASS, FUNCTION)
@OptionalExpectation
expect annotation class IgnoreOnSimulatorPlatforms()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package dev.kord.test

import kotlin.test.Ignore

actual typealias IgnoreOnSimulatorPlatforms = Ignore

0 comments on commit c68a078

Please sign in to comment.