-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom test logger that writes to stderr
- Loading branch information
Showing
3 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/jvmTest/kotlin/fr/acinq/lightning/tests/utils/TestLogger.jvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package fr.acinq.lightning.tests.utils | ||
|
||
actual fun printToStderr(msg: String) { | ||
System.err.println(msg) | ||
} |
12 changes: 12 additions & 0 deletions
12
src/nativeTest/kotlin/fr/acinq/lightning/tests/utils/TestLogger.native.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package fr.acinq.lightning.tests.utils | ||
|
||
import kotlinx.cinterop.ExperimentalForeignApi | ||
import platform.posix.fflush | ||
import platform.posix.fprintf | ||
|
||
@OptIn(ExperimentalForeignApi::class) | ||
actual fun printToStderr(msg: String) { | ||
val stderr = platform.posix.fdopen(2, "w") | ||
fprintf(stderr, msg + "\n") | ||
fflush(stderr) | ||
} |