aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r--plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt79
-rw-r--r--plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt78
2 files changed, 127 insertions, 30 deletions
diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
index 50580afc..7e11dc85 100644
--- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
+++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
@@ -450,17 +450,17 @@ class ContentForParamsTest : BaseAbstractTest() {
}
after {
group { pWrapped("a normal comment") }
- header(2) { +"Throws" }
+ header(4) { +"Throws" }
table {
group {
group {
- link { +"java.lang.IllegalStateException" }
+ link { +"IllegalStateException" }
}
comment { +"if the Dialog has not yet been created (before onCreateDialog) or has been destroyed (after onDestroyView)." }
}
group {
group {
- link { +"java.lang.RuntimeException" }
+ link { +"RuntimeException" }
}
comment {
+"when "
@@ -507,7 +507,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
after {
group { pWrapped("a normal comment") }
- header(2) { +"Throws" }
+ header(4) { +"Throws" }
table {
group {
group {
@@ -518,7 +518,7 @@ class ContentForParamsTest : BaseAbstractTest() {
(this as ContentDRILink).address.toString()
)
}
- +"java.lang.IllegalStateException"
+ +"IllegalStateException"
}
}
comment { +"if the Dialog has not yet been created (before onCreateDialog) or has been destroyed (after onDestroyView)." }
@@ -532,7 +532,7 @@ class ContentForParamsTest : BaseAbstractTest() {
(this as ContentDRILink).address.toString()
)
}
- +"java.lang.RuntimeException"
+ +"RuntimeException"
}
}
comment {
@@ -551,6 +551,51 @@ class ContentForParamsTest : BaseAbstractTest() {
}
@Test
+ fun `should display fully qualified throws name for unresolved class`() {
+ testInline(
+ """
+ |/src/main/kotlin/sample/sample.kt
+ |package sample;
+ | /**
+ | * a normal comment
+ | *
+ | * @throws com.example.UnknownException description for non-resolved
+ | */
+ | fun sample(){ }
+ """.trimIndent(), testConfiguration
+ ) {
+ pagesTransformationStage = { module ->
+ val functionPage =
+ module.children.single { it.name == "sample" }.children.single { it.name == "sample" } as ContentPage
+ functionPage.content.assertNode {
+ group {
+ header(1) { +"sample" }
+ }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ skipAllNotMatching() //Signature
+ }
+ after {
+ group { pWrapped("a normal comment") }
+ header(4) { +"Throws" }
+ table {
+ group {
+ group {
+ +"com.example.UnknownException"
+ }
+ comment { +"description for non-resolved" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Test
fun `multiline throws where exception is not in the same line as description`() {
testInline(
"""
@@ -585,7 +630,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
after {
group { pWrapped("a normal comment") }
- header(2) { +"Throws" }
+ header(4) { +"Throws" }
table {
group {
group {
@@ -596,7 +641,7 @@ class ContentForParamsTest : BaseAbstractTest() {
(this as ContentDRILink).address.toString()
)
}
- +"java.lang.IllegalStateException"
+ +"IllegalStateException"
}
}
comment { +"if the Dialog has not yet been created (before onCreateDialog) or has been destroyed (after onDestroyView)." }
@@ -610,7 +655,7 @@ class ContentForParamsTest : BaseAbstractTest() {
(this as ContentDRILink).address.toString()
)
}
- +"java.lang.RuntimeException"
+ +"RuntimeException"
}
}
comment {
@@ -719,7 +764,7 @@ class ContentForParamsTest : BaseAbstractTest() {
+" doesn't contain value."
}
}
- header(2) { +"Parameters" }
+ header(4) { +"Parameters" }
group {
table {
group {
@@ -1007,7 +1052,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
after {
group { pWrapped("comment to function") }
- header(2) { +"Parameters" }
+ header(4) { +"Parameters" }
group {
table {
group {
@@ -1060,7 +1105,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
after {
group { group { group { +"comment to function" } } }
- header(2) { +"Parameters" }
+ header(4) { +"Parameters" }
group {
table {
group {
@@ -1122,7 +1167,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
after {
group { group { group { +"comment to function" } } }
- header(2) { +"Parameters" }
+ header(4) { +"Parameters" }
group {
table {
group {
@@ -1181,7 +1226,7 @@ class ContentForParamsTest : BaseAbstractTest() {
)
}
after {
- header(2) { +"Parameters" }
+ header(4) { +"Parameters" }
group {
table {
group {
@@ -1249,7 +1294,7 @@ class ContentForParamsTest : BaseAbstractTest() {
header(4) { +"Receiver" }
pWrapped("comment to receiver")
}
- header(2) { +"Parameters" }
+ header(4) { +"Parameters" }
group {
table {
group {
@@ -1301,7 +1346,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
after {
group { group { group { +"comment to function" } } }
- header(2) { +"Parameters" }
+ header(4) { +"Parameters" }
group {
table {
group {
@@ -1362,7 +1407,7 @@ class ContentForParamsTest : BaseAbstractTest() {
group { pWrapped("comment to function") }
unnamedTag("Author") { comment { +"Kordyjan" } }
unnamedTag("Since") { comment { +"0.11" } }
- header(2) { +"Parameters" }
+ header(4) { +"Parameters" }
group {
table {
diff --git a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
index 4096640a..5c1fd054 100644
--- a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
+++ b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
@@ -97,13 +97,12 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
)
}
after {
- header(2) { +"See also" }
+ header(4) { +"See also" }
group {
table {
group {
//DRI should be "test//abc/#/-1/"
link { +"abc" }
- group { }
}
}
}
@@ -150,7 +149,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
)
}
after {
- header(2) { +"See also" }
+ header(4) { +"See also" }
group {
table {
group {
@@ -171,6 +170,60 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
}
@Test
+ fun `should use fully qualified name for unresolved link`() {
+ testInline(
+ """
+ |/src/main/kotlin/test/source.kt
+ |package test
+ | /**
+ | * @see com.example.NonExistingClass description for non-existing
+ | */
+ |fun function(abc: String) {
+ | println(abc)
+ |}
+ """.trimIndent(), testConfiguration
+ ) {
+ pagesTransformationStage = { module ->
+ val page = module.children.single { it.name == "test" }
+ .children.single { it.name == "function" } as ContentPage
+ page.content.assertNode {
+ group {
+ header(1) { +"function" }
+ }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature(
+ emptyMap(),
+ "",
+ "",
+ emptySet(),
+ "function",
+ null,
+ "abc" to ParamAttributes(emptyMap(), emptySet(), "String")
+ )
+ }
+ after {
+ header(4) { +"See also" }
+ group {
+ table {
+ group {
+ +"com.example.NonExistingClass"
+ group {
+ group { +"description for non-existing" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Test
fun `undocumented seealso with stdlib link`() {
testInline(
"""
@@ -205,7 +258,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
)
}
after {
- header(2) { +"See also" }
+ header(4) { +"See also" }
group {
table {
group {
@@ -216,9 +269,8 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
(this as ContentDRILink).address.toString()
)
}
- +"kotlin.collections.Collection"
+ +"Collection"
}
- group { }
}
}
}
@@ -265,12 +317,12 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
)
}
after {
- header(2) { +"See also" }
+ header(4) { +"See also" }
group {
table {
group {
//DRI should be "test//abc/#/-1/"
- link { +"kotlin.collections.Collection" }
+ link { +"Collection" }
group {
group { +"Comment to stdliblink" }
}
@@ -327,12 +379,12 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
unnamedTag("Author") { comment { +"pikinier20" } }
unnamedTag("Since") { comment { +"0.11" } }
- header(2) { +"See also" }
+ header(4) { +"See also" }
group {
table {
group {
//DRI should be "test//abc/#/-1/"
- link { +"kotlin.collections.Collection" }
+ link { +"Collection" }
group {
group { +"Comment to stdliblink" }
}
@@ -383,7 +435,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
)
}
after {
- header(2) { +"See also" }
+ header(4) { +"See also" }
group {
table {
group {
@@ -439,7 +491,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
)
}
after {
- header(2) { +"See also" }
+ header(4) { +"See also" }
group {
table {
group {
@@ -451,7 +503,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
}
group {
//DRI should be "test//abc/#/-1/"
- link { +"kotlin.collections.Collection" }
+ link { +"Collection" }
group { group { +"Comment to collection" } }
}
}