From 6176a7d31fa52a065a146fe6f2d10cb2c493a0f5 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Tue, 14 Jan 2025 08:24:10 +0100 Subject: [PATCH 1/2] Trivially fix a formatting mistake Add a space after the comma. This is a fixup for 8a1c846. --- .../src/test/kotlin/com/sksamuel/hoplite/PropertySourceTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoplite-core/src/test/kotlin/com/sksamuel/hoplite/PropertySourceTest.kt b/hoplite-core/src/test/kotlin/com/sksamuel/hoplite/PropertySourceTest.kt index 525a84ac..1287d6ab 100644 --- a/hoplite-core/src/test/kotlin/com/sksamuel/hoplite/PropertySourceTest.kt +++ b/hoplite-core/src/test/kotlin/com/sksamuel/hoplite/PropertySourceTest.kt @@ -42,7 +42,7 @@ class PropertySourceTest : FunSpec() { } test("reads config from map") { - data class TestConfig(val a: String, val b: Int, val other: List, val nested: Map) + data class TestConfig(val a: String, val b: Int, val other: List, val nested: Map) val arguments = mapOf( "a" to "A value", From 85950a1cd2bfd88fed2748825a39acd05d2514c2 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Tue, 14 Jan 2025 08:26:25 +0100 Subject: [PATCH 2/2] Extend a `CommandLinePropertySource` test with a nested map --- .../kotlin/com/sksamuel/hoplite/PropertySourceTest.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hoplite-core/src/test/kotlin/com/sksamuel/hoplite/PropertySourceTest.kt b/hoplite-core/src/test/kotlin/com/sksamuel/hoplite/PropertySourceTest.kt index 1287d6ab..62c17821 100644 --- a/hoplite-core/src/test/kotlin/com/sksamuel/hoplite/PropertySourceTest.kt +++ b/hoplite-core/src/test/kotlin/com/sksamuel/hoplite/PropertySourceTest.kt @@ -61,14 +61,16 @@ class PropertySourceTest : FunSpec() { } test("reads config from command line") { - data class TestConfig(val a: String, val b: Int, val other: List) + data class TestConfig(val a: String, val b: Int, val other: List, val nested: Map) val arguments = arrayOf( "--a=A value", "--b=42", "some other value", "--other=Value1", - "--other=Value2" + "--other=Value2", + "--nested.foo=bar", + "--nested.john=doe" ) val config = ConfigLoaderBuilder.default() @@ -76,7 +78,7 @@ class PropertySourceTest : FunSpec() { .build() .loadConfigOrThrow() - config shouldBe TestConfig("A value", 42, listOf("Value1", "Value2")) + config shouldBe TestConfig("A value", 42, listOf("Value1", "Value2"), mapOf("foo" to "bar", "john" to "doe")) } test("reads from added source before default sources") {