From ec637955575995011351b106d3a67194d21c4b15 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Mon, 14 Sep 2020 13:49:54 +0200 Subject: Introduce top-level DocTag --- plugins/base/src/test/kotlin/model/CommentTest.kt | 36 +++++++++++++--------- .../base/src/test/kotlin/model/FunctionsTest.kt | 6 ++-- plugins/base/src/test/kotlin/model/JavaTest.kt | 2 +- 3 files changed, 25 insertions(+), 19 deletions(-) (limited to 'plugins/base/src/test/kotlin/model') diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt index c1da8ee0..613576ae 100644 --- a/plugins/base/src/test/kotlin/model/CommentTest.kt +++ b/plugins/base/src/test/kotlin/model/CommentTest.kt @@ -30,16 +30,21 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme ) { with((this / "comment" / "prop1").cast()) { name equals "prop1" - with(this.docs().firstOrNull()?.root.assertNotNull("Code")) { - (children.firstOrNull() as? Text) + with(this.docs().firstOrNull()?.children?.firstOrNull()?.assertNotNull("Code")) { + (this?.children?.firstOrNull() as? Text) ?.body equals "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>." - params["lang"] equals "brainfuck" + this?.params?.get("lang") equals "brainfuck" } } with((this / "comment" / "prop2").cast()) { name equals "prop2" - comments() equals "a + b - c" + with(this.docs().firstOrNull()?.children?.firstOrNull()?.assertNotNull("Code")) { + (this?.children?.firstOrNull() as? Text) + ?.body equals "a + b - c" + + this?.params?.get("lang") equals null + } } } } @@ -88,7 +93,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals "doc1\ndoc2 doc3" + comments() equals "doc1\ndoc2 doc3\n" } } } @@ -108,7 +113,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals "doc1\ndoc2 doc3" + comments() equals "doc1\ndoc2 doc3\n" } } } @@ -122,7 +127,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals "doc" + comments() equals "doc\n" } } } @@ -137,7 +142,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals "doc" + comments() equals "doc\n" } } } @@ -152,7 +157,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals "doc" + comments() equals "doc\n" } } } @@ -169,7 +174,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals "Summary\none: []" + comments() equals "Summary\n\none: []" docs().find { it is CustomTagWrapper && it.name == "one" }.let { with(it.assertNotNull("'one' entry")) { root.children counts 0 @@ -189,7 +194,8 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals """it's "useful"""" + comments() equals """it's "useful" +""" } } } @@ -206,7 +212,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals "Summary\none: [section one]" + comments() equals "Summary\n\none: [section one\n]" } } } @@ -225,7 +231,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals "Summary\none: [section one]\ntwo: [section two]" + comments() equals "Summary\n\none: [section one\n]\ntwo: [section two\n]" } } } @@ -244,7 +250,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { with((this / "comment" / "property").cast()) { - comments() equals "Summary\none: [line one line two]" + comments() equals "Summary\n\none: [line one line two\n]" } } } @@ -329,4 +335,4 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme // } // } -} \ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt index c96e7df6..9fffb4fc 100644 --- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt +++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt @@ -118,14 +118,14 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun """ ) { with((this / "function" / "function").cast()) { - comments() equals "Multiline\nFunction Documentation" + comments() equals "Multiline\nFunction Documentation\n" name equals "function" parameters counts 1 parameters.firstOrNull().assertNotNull("Parameter: ").also { it.name equals "x" it.type.name equals "Int" - it.comments() equals "parameter" + it.comments() equals "parameter\n" } type.assertNotNull("Return type: ").name equals "Unit" @@ -393,4 +393,4 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun } } -} \ No newline at end of file +} diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt index 4e9b9de4..51d7556c 100644 --- a/plugins/base/src/test/kotlin/model/JavaTest.kt +++ b/plugins/base/src/test/kotlin/model/JavaTest.kt @@ -34,7 +34,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { with((this / "fn").cast()) { name equals "fn" val params = parameters.map { it.documentation.values.first().children.first() as Param } - params.mapNotNull { it.firstChildOfTypeOrNull()?.body } equals listOf("is String parameter", "is int parameter") + params.mapNotNull { it.firstMemberOfType()?.body } equals listOf("is String parameter", "is int parameter") } } } -- cgit