Skip to content

Commit

Permalink
Added test for enum parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
testersen committed Nov 1, 2023
1 parent b49ee0b commit ee97503
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/test/kotlin/Tests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals

enum class Lol {
Foo,
Bar,
Baz
}

data class TestClass @EnvConstructor(prefix = "TEST_") constructor(
@Env val int: Int,
@Env val numbers: @ListEnv(separator = ";") List<@ListEnv(separator = ".") List<Int>>
@Env val numbers: @ListEnv(separator = ";") List<@ListEnv(separator = ".") List<Int>>,
@Env val lol: Lol,
)

class Tests {
Expand All @@ -35,7 +42,8 @@ class Tests {
fun `construct simple data class`() {
Environment.set(
"TEST_INT" to "123",
"TEST_NUMBERS" to "1.2;3.4;5.6;7.8"
"TEST_NUMBERS" to "1.2;3.4;5.6;7.8",
"TEST_LOL" to "Foo"
)
val derived = construct<TestClass>()
assertEquals(derived.int, 123)
Expand Down

0 comments on commit ee97503

Please sign in to comment.