aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test
diff options
context:
space:
mode:
authorPaweł Marks <pmarks@virtuslab.com>2020-03-18 18:38:38 +0100
committerPaweł Marks <pmarks@virtuslab.com>2020-03-18 18:38:38 +0100
commit4e7af2084c98f905b4fcd7fbe231c19bf186205d (patch)
tree0c06ae26c8426d71c205246d39bbbd8271228d49 /plugins/base/src/test
parentc92427162c3232cb54c73f63867258a31be526e9 (diff)
downloaddokka-4e7af2084c98f905b4fcd7fbe231c19bf186205d.tar.gz
dokka-4e7af2084c98f905b4fcd7fbe231c19bf186205d.tar.bz2
dokka-4e7af2084c98f905b4fcd7fbe231c19bf186205d.zip
Make DefaultValue extra property actualy do something
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r--plugins/base/src/test/kotlin/model/FunctionsTest.kt37
1 files changed, 20 insertions, 17 deletions
diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
index 068c2895..e00e51fc 100644
--- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt
+++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
@@ -315,7 +315,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
}
@Test
- fun functionWithDefaultParameter() {
+ fun functionWithDefaultStringParameter() {
inlineModelTest(
"""
|/src/main/kotlin/function/Test.kt
@@ -323,31 +323,34 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
|fun f(x: String = "") {}
"""
) {
- // TODO add default value data
-
with((this / "function" / "f").cast<DFunction>()) {
parameters.forEach { p ->
p.name equals "x"
p.type.name.assertNotNull("Parameter type: ") equals "String"
- assert(false) { "No default value data" }
+ p.extra[DefaultValue]?.value equals "\"\""
}
}
}
}
-// @Test fun functionWithDefaultParameter() {
-// checkSourceExistsAndVerifyModel("testdata/functions/functionWithDefaultParameter.kt", defaultModelConfig) { model ->
-// with(model.members.single().members.single()) {
-// with(details.elementAt(3)) {
-// val value = details(NodeKind.Value)
-// assertEquals(1, value.count())
-// with(value[0]) {
-// assertEquals("\"\"", name)
-// }
-// }
-// }
-// }
-// }
+ @Test
+ fun functionWithDefaultFloatParameter() {
+ inlineModelTest(
+ """
+ |/src/main/kotlin/function/Test.kt
+ |package function
+ |fun f(x: Float = 3.14f) {}
+ """
+ ) {
+ with((this / "function" / "f").cast<DFunction>()) {
+ parameters.forEach { p ->
+ p.name equals "x"
+ p.type.name.assertNotNull("Parameter type: ") equals "Float"
+ p.extra[DefaultValue]?.value equals "3.14f"
+ }
+ }
+ }
+ }
@Test
fun sinceKotlin() {