-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for Kotest tests #243
Changes from 1 commit
b849347
ac9efc7
c9da234
1125704
fe5a71f
335f95c
cf6badf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,26 @@ | ||
package com.akuleshov7.ktoml.decoders | ||
|
||
import com.akuleshov7.ktoml.Toml | ||
import io.kotest.matchers.shouldBe | ||
import kotlinx.serialization.ExperimentalSerializationApi | ||
import kotlin.test.Test | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.serializer | ||
import kotlin.test.assertEquals | ||
|
||
@ExperimentalSerializationApi | ||
class PartialDecoderTest { | ||
@Serializable | ||
data class TwoTomlTables(val table1: Table1, val table2: Table2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this was removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not see this class anymore in the tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was removed because it was actually not used. In this test you are providing a toml example which as a whole is parseable to |
||
|
||
@Serializable | ||
data class Table1(val a: Long, val b: Long) | ||
|
||
@Serializable | ||
data class Table2(val c: Long, val e: Long, val d: Long) | ||
|
||
@Test | ||
fun testPartialDecoding() { | ||
val test = TwoTomlTables(Table1(1, 2), Table2(1, 2, 3)) | ||
assertEquals( | ||
test.table1, | ||
Toml.partiallyDecodeFromString( | ||
serializer(), | ||
"[table1] \n a = 1 \n b = 2 \n [table2] \n c = 1 \n e = 2 \n d = 3", | ||
"table1" | ||
) | ||
val parsedResult = Toml.partiallyDecodeFromString<Table1>( | ||
serializer(), | ||
"[table1] \n a = 1 \n b = 2 \n [table2] \n c = 1 \n e = 2 \n d = 3", | ||
"table1" | ||
) | ||
|
||
parsedResult shouldBe Table1(1, 2) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you did not remove Junit then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like Junit still remains @ILikeYourHat what was the idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrating to Kotest is a big change, and my idea was to migrate step by step, PR by PR, to make CR easier and avoid possible conflicts. However I can migrate all tests at once in this PR, if you prefer that way. It is up to you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do a migration - it is difficult to keep both Unit and Kotest :(
Better to migrate everything, sorry 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akuleshov7 it took a while, but here you have it: everything migrated to Kotest :)
Please note that the actual runner for jvm is still JUnit5. Kotest also have an jvm test runner, but the test format is very different there: https://kotest.io/docs/framework/writing-tests.html. I know, the issue mentions also the change of the runner, but in my opinion: