Skip to content

Commit

Permalink
Add more Apple ARM64 platforms: macOS, tvOS, watchOS
Browse files Browse the repository at this point in the history
  • Loading branch information
saschpe committed Mar 23, 2024
1 parent ef52c53 commit 7027123
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 160 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Allow empty log messages if you only want to create a log entry about a function being called.
- Add more Apple ARM64 platforms: macOS, tvOS, watchOS
- Dependency update:
- [Kotlin 1.9.10](https://kotlinlang.org/docs/whatsnew19.html)
- [Gradle-8.7](https://docs.gradle.org/8.7/release-notes.html)
Expand Down
11 changes: 4 additions & 7 deletions log4k-slf4j/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ kotlin {
androidTarget { publishAllLibraryVariants() }
iosArm64()
iosSimulatorArm64()
js {
nodejs()
compilations.all {
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = "umd"
}
}
js { nodejs() }
jvm { testRuns["test"].executionTask.configure { useJUnitPlatform() } }
macosArm64()
tvosArm64()
watchosArm64()

applyDefaultHierarchyTemplate()

Expand Down
11 changes: 4 additions & 7 deletions log4k/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ kotlin {
androidTarget { publishAllLibraryVariants() }
iosArm64()
iosSimulatorArm64()
js {
nodejs()
compilations.all {
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = "umd"
}
}
js { nodejs() }
jvm { testRuns["test"].executionTask.configure { useJUnitPlatform() } }
macosArm64()
tvosArm64()
watchosArm64()

applyDefaultHierarchyTemplate()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package saschpe.log4k

internal actual val expectedListTag: String = "ArrayList"
internal actual val expectedMapTag: String = "SingletonMap"
4 changes: 4 additions & 0 deletions log4k/src/appleTest/kotlin/saschpe/log4k/LoggedTest.apple.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package saschpe.log4k

internal actual val expectedListTag: String = ""
internal actual val expectedMapTag: String = "HashMap"
27 changes: 4 additions & 23 deletions log4k/src/commonTest/kotlin/saschpe/log4k/LogTest.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package saschpe.log4k

import testing.*
import kotlin.test.*

class LogTest {
@BeforeTest // Arrange
fun before() {
Log.loggers.clear()
Log.loggers += TestLogger()
}
import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertTrue

class LogTest : TestLoggerTest() {
@Test
fun verbose() {
// Act
Expand Down Expand Up @@ -172,18 +168,6 @@ class LogTest {
assertTestLogger(Log.Level.Assert)
}

@Test
fun logged_Pair() {
// Arrange
val pair = Pair("Hello", "World")

// Act
pair.logged()

// Assert
assertTestLogger(Log.Level.Debug, "(Hello, World)", "Pair", null)
}

@Test
fun isDebugEnabled() {
assertTrue(Log.isDebugEnabled, "TestLogger defaults to ${Log.Level.Verbose}")
Expand All @@ -196,7 +180,4 @@ class LogTest {
Log.loggers.clear()
assertFalse(Log.isDebugEnabled)
}

@AfterTest
fun after() = Log.loggers.clear()
}
46 changes: 46 additions & 0 deletions log4k/src/commonTest/kotlin/saschpe/log4k/LoggedTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package saschpe.log4k

import testing.TestLoggerTest
import testing.assertTestLogger
import kotlin.test.Test

internal expect val expectedListTag: String
internal expect val expectedMapTag: String

class LoggedTest : TestLoggerTest() {
@Test
fun logged_Pair() {
// Arrange
val pair = Pair("Hello", "World")

// Act
pair.logged()

// Assert
assertTestLogger(Log.Level.Debug, "(Hello, World)", "Pair", null)
}

@Test
fun logged_List() {
// Arrange
val list = listOf("Hello", "World")

// Act
list.logged()

// Assert
assertTestLogger(Log.Level.Debug, "[Hello, World]", expectedListTag, null)
}

@Test
fun logged_Map() {
// Arrange
val map = mapOf("Hello" to "World")

// Act
map.logged()

// Assert
assertTestLogger(Log.Level.Debug, "{Hello=World}", expectedMapTag, null)
}
}
16 changes: 16 additions & 0 deletions log4k/src/commonTest/kotlin/testing/TestLoggerTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package testing

import saschpe.log4k.Log
import kotlin.test.AfterTest
import kotlin.test.BeforeTest

abstract class TestLoggerTest {
@BeforeTest // Arrange
fun before() {
Log.loggers.clear()
Log.loggers += TestLogger()
}

@AfterTest
fun after() = Log.loggers.clear()
}
41 changes: 0 additions & 41 deletions log4k/src/iosTest/kotlin/saschpe/log4k/LogTestIos.kt

This file was deleted.

41 changes: 0 additions & 41 deletions log4k/src/jsTest/kotlin/saschpe/log4k/LogTestJs.kt

This file was deleted.

4 changes: 4 additions & 0 deletions log4k/src/jsTest/kotlin/saschpe/log4k/LoggedTest.js.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package saschpe.log4k

internal actual val expectedListTag: String = "ArrayList"
internal actual val expectedMapTag: String = "HashMap"
41 changes: 0 additions & 41 deletions log4k/src/jvmTest/kotlin/saschpe/log4k/LogTestJvm.kt

This file was deleted.

4 changes: 4 additions & 0 deletions log4k/src/jvmTest/kotlin/saschpe/log4k/LoggedTest.jvm.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package saschpe.log4k

internal actual val expectedListTag: String = "ArrayList"
internal actual val expectedMapTag: String = "SingletonMap"

0 comments on commit 7027123

Please sign in to comment.