Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit a74776d

Browse files
committed
デフォルト値を用いる場合のテストを追加
1 parent be5a212 commit a74776d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/kotlin/com/mapk/core/KFunctionForCallTest.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ class KFunctionForCallTest {
5252
val result = kFunctionForCall.call(bucket)
5353
assertEquals("12", result)
5454
}
55+
56+
private fun func(key: String, value: String = "default"): Pair<String, String> = key to value
57+
58+
@Test
59+
@DisplayName("デフォルト値を用いる場合")
60+
fun useDefaultValue() {
61+
val kFunctionForCall = KFunctionForCall(::func)
62+
val argumentBucket = kFunctionForCall.getArgumentBucket()
63+
64+
::func.parameters.forEach { if (!it.isOptional) argumentBucket.setArgument(it, it.name) }
65+
66+
val result = kFunctionForCall.call(argumentBucket)
67+
assertEquals("key" to "default", result)
68+
}
5569
}
5670

5771
companion object {

0 commit comments

Comments
 (0)