aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/data/classes/annotatedClass.kt2
-rw-r--r--test/data/classes/annotatedClassWithAnnotationParameters.kt2
-rw-r--r--test/data/classes/dataClass.kt1
-rw-r--r--test/data/classes/javaAnnotationClass.kt2
-rw-r--r--test/data/classes/sealedClass.kt1
-rw-r--r--test/data/format/annotatedTypeParameter.kt2
-rw-r--r--test/data/format/annotatedTypeParameter.md8
-rw-r--r--test/data/format/annotationParams.kt2
-rw-r--r--test/data/format/annotationParams.md2
-rw-r--r--test/data/format/annotations.md4
-rw-r--r--test/data/format/crossLanguage/kotlinExtendsJava/Bar.html11
-rw-r--r--test/data/format/deprecated.kt6
-rw-r--r--test/data/format/enumClass.kt2
-rw-r--r--test/data/format/enumClass.md2
-rw-r--r--test/data/format/extensionFunctionParameter.kt1
-rw-r--r--test/data/format/extensionFunctionParameter.md8
-rw-r--r--test/data/format/extensions.class.md8
-rw-r--r--test/data/format/extensions.package.md2
-rw-r--r--test/data/format/inheritedExtensions.kt11
-rw-r--r--test/data/format/inheritedExtensions.md21
-rw-r--r--test/data/format/inheritedMembers.kt12
-rw-r--r--test/data/format/inheritedMembers.md38
-rw-r--r--test/data/format/javaDeprecated.html2
-rw-r--r--test/data/format/javaSupertype.html2
-rw-r--r--test/data/format/javadocHtml.md2
-rw-r--r--test/data/format/javadocOrderedList.md2
-rw-r--r--test/data/format/operatorOverloading.md2
-rw-r--r--test/data/format/orderedList.html1
-rw-r--r--test/data/format/overloadsWithDescription.html1
-rw-r--r--test/data/format/overloadsWithDifferentDescriptions.html2
-rw-r--r--test/data/format/parameterAnchor.html2
-rw-r--r--test/data/format/reifiedTypeParameter.kt3
-rw-r--r--test/data/format/reifiedTypeParameter.md8
-rw-r--r--test/data/format/starProjection.kt3
-rw-r--r--test/data/format/starProjection.md8
-rw-r--r--test/data/format/summarizeSignatures.kt20
-rw-r--r--test/data/format/summarizeSignatures.md23
-rw-r--r--test/data/format/summarizeSignaturesProperty.kt20
-rw-r--r--test/data/format/summarizeSignaturesProperty.md23
-rw-r--r--test/data/format/tripleBackticks.html1
-rw-r--r--test/data/format/typeParameterBounds.md2
-rw-r--r--test/data/format/typeProjectionVariance.md6
-rw-r--r--test/data/functions/annotatedFunction.kt2
-rw-r--r--test/data/functions/annotatedFunctionWithAnnotationParameters.kt8
-rw-r--r--test/data/functions/functionWithAnnotatedParam.kt7
-rw-r--r--test/data/functions/functionWithNoinlineParam.kt2
-rw-r--r--test/data/functions/functionWithNotDocumentedAnnotation.kt2
-rw-r--r--test/data/functions/inlineFunction.kt2
-rw-r--r--test/data/packagedocs/stdlib.md11
-rw-r--r--test/data/properties/annotatedProperty.kt2
-rw-r--r--test/src/TestAPI.kt48
-rw-r--r--test/src/format/HtmlFormatTest.kt52
-rw-r--r--test/src/format/MarkdownFormatTest.kt113
-rw-r--r--test/src/format/PackageDocsTest.kt18
-rw-r--r--test/src/markdown/MarkdownTestRunner.kt133
-rw-r--r--test/src/markdown/ParserTest.kt43
-rw-r--r--test/src/markdown/Specification.kt11
-rw-r--r--test/src/model/ClassTest.kt90
-rw-r--r--test/src/model/CommentTest.kt24
-rw-r--r--test/src/model/FunctionTest.kt80
-rw-r--r--test/src/model/JavaTest.kt59
-rw-r--r--test/src/model/LinkTest.kt8
-rw-r--r--test/src/model/PackageTest.kt10
-rw-r--r--test/src/model/PropertyTest.kt30
64 files changed, 628 insertions, 408 deletions
diff --git a/test/data/classes/annotatedClass.kt b/test/data/classes/annotatedClass.kt
index 62c6f0ec..1b58f56c 100644
--- a/test/data/classes/annotatedClass.kt
+++ b/test/data/classes/annotatedClass.kt
@@ -1 +1 @@
-data class Foo() {}
+@Strictfp class Foo() {}
diff --git a/test/data/classes/annotatedClassWithAnnotationParameters.kt b/test/data/classes/annotatedClassWithAnnotationParameters.kt
index 1af97e75..930d6a62 100644
--- a/test/data/classes/annotatedClassWithAnnotationParameters.kt
+++ b/test/data/classes/annotatedClassWithAnnotationParameters.kt
@@ -1 +1 @@
-deprecated("should no longer be used") class Foo() {}
+@Deprecated("should no longer be used") class Foo() {}
diff --git a/test/data/classes/dataClass.kt b/test/data/classes/dataClass.kt
new file mode 100644
index 00000000..62c6f0ec
--- /dev/null
+++ b/test/data/classes/dataClass.kt
@@ -0,0 +1 @@
+data class Foo() {}
diff --git a/test/data/classes/javaAnnotationClass.kt b/test/data/classes/javaAnnotationClass.kt
index c5f5cac4..95600147 100644
--- a/test/data/classes/javaAnnotationClass.kt
+++ b/test/data/classes/javaAnnotationClass.kt
@@ -1,5 +1,5 @@
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
-Retention(RetentionPolicy.SOURCE)
+@Retention(RetentionPolicy.SOURCE)
public annotation class throws()
diff --git a/test/data/classes/sealedClass.kt b/test/data/classes/sealedClass.kt
new file mode 100644
index 00000000..93350393
--- /dev/null
+++ b/test/data/classes/sealedClass.kt
@@ -0,0 +1 @@
+sealed class Foo() {}
diff --git a/test/data/format/annotatedTypeParameter.kt b/test/data/format/annotatedTypeParameter.kt
new file mode 100644
index 00000000..cc3bfc1a
--- /dev/null
+++ b/test/data/format/annotatedTypeParameter.kt
@@ -0,0 +1,2 @@
+public fun <E> containsAll(elements: Collection<@UnsafeVariance E>): @UnsafeVariance E {
+}
diff --git a/test/data/format/annotatedTypeParameter.md b/test/data/format/annotatedTypeParameter.md
new file mode 100644
index 00000000..7d26a162
--- /dev/null
+++ b/test/data/format/annotatedTypeParameter.md
@@ -0,0 +1,8 @@
+[test](test/index) / [containsAll](test/contains-all)
+
+
+# containsAll
+
+`fun &lt;E&gt; containsAll(elements:&nbsp;Collection&lt;@UnsafeVariance E&gt;): @UnsafeVariance E`
+
+
diff --git a/test/data/format/annotationParams.kt b/test/data/format/annotationParams.kt
index ee5b524a..f259a740 100644
--- a/test/data/format/annotationParams.kt
+++ b/test/data/format/annotationParams.kt
@@ -1 +1 @@
-inlineOptions(InlineOption.LOCAL_CONTINUE_AND_BREAK) fun f() {}
+@JvmName("FFF") fun f() {}
diff --git a/test/data/format/annotationParams.md b/test/data/format/annotationParams.md
index 80fe52cf..8cdd6e96 100644
--- a/test/data/format/annotationParams.md
+++ b/test/data/format/annotationParams.md
@@ -3,6 +3,6 @@
# f
-`inlineOptions([InlineOption.LOCAL_CONTINUE_AND_BREAK]) fun f(): Unit`
+`@JvmName("FFF") fun f(): Unit`
diff --git a/test/data/format/annotations.md b/test/data/format/annotations.md
index caf84084..b898d55c 100644
--- a/test/data/format/annotations.md
+++ b/test/data/format/annotations.md
@@ -16,11 +16,11 @@
### Properties
-| [x](test/-foo/x) | `inline val x: Int` |
+| [x](test/-foo/x) | `val x: Int` |
### Functions
-| [bar](test/-foo/bar) | `inline fun bar(noinline notInlined:&nbsp;()&nbsp;-&gt;&nbsp;Unit): Unit` |
+| [bar](test/-foo/bar) | `fun bar(notInlined:&nbsp;()&nbsp;-&gt;&nbsp;Unit): Unit` |
diff --git a/test/data/format/crossLanguage/kotlinExtendsJava/Bar.html b/test/data/format/crossLanguage/kotlinExtendsJava/Bar.html
index 5b93d837..e7b139d8 100644
--- a/test/data/format/crossLanguage/kotlinExtendsJava/Bar.html
+++ b/test/data/format/crossLanguage/kotlinExtendsJava/Bar.html
@@ -22,5 +22,16 @@
</tr>
</tbody>
</table>
+<h3>Inherited Functions</h3>
+<table>
+<tbody>
+<tr>
+<td>
+<a href="test/test/-foo/xyzzy">xyzzy</a></td>
+<td>
+<code><span class="keyword">open</span> <span class="keyword">fun </span><span class="identifier">xyzzy</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></td>
+</tr>
+</tbody>
+</table>
</BODY>
</HTML>
diff --git a/test/data/format/deprecated.kt b/test/data/format/deprecated.kt
index 9ee2c1d6..4fc568c2 100644
--- a/test/data/format/deprecated.kt
+++ b/test/data/format/deprecated.kt
@@ -1,5 +1,5 @@
-deprecated("This class sucks") class C() { }
+@Deprecated("This class sucks") class C() { }
-deprecated("This function sucks") fun f() { }
+@Deprecated("This function sucks") fun f() { }
-deprecated("This property sucks") val p: Int get() = 0
+@Deprecated("This property sucks") val p: Int get() = 0
diff --git a/test/data/format/enumClass.kt b/test/data/format/enumClass.kt
index 5988c644..c1af69d8 100644
--- a/test/data/format/enumClass.kt
+++ b/test/data/format/enumClass.kt
@@ -1,4 +1,4 @@
public enum class InlineOption {
- LOCAL_CONTINUE_AND_BREAK
+ LOCAL_CONTINUE_AND_BREAK,
ONLY_LOCAL_RETURN
}
diff --git a/test/data/format/enumClass.md b/test/data/format/enumClass.md
index da1ef851..7a0e03ff 100644
--- a/test/data/format/enumClass.md
+++ b/test/data/format/enumClass.md
@@ -3,7 +3,7 @@
# InlineOption
-`public enum class InlineOption`
+`enum class InlineOption`
diff --git a/test/data/format/extensionFunctionParameter.kt b/test/data/format/extensionFunctionParameter.kt
new file mode 100644
index 00000000..bfb344b9
--- /dev/null
+++ b/test/data/format/extensionFunctionParameter.kt
@@ -0,0 +1 @@
+public inline fun <T> T.apply(f: T.() -> Unit): T { f(); return this }
diff --git a/test/data/format/extensionFunctionParameter.md b/test/data/format/extensionFunctionParameter.md
new file mode 100644
index 00000000..6980912d
--- /dev/null
+++ b/test/data/format/extensionFunctionParameter.md
@@ -0,0 +1,8 @@
+[test](test/index) / [apply](test/apply)
+
+
+# apply
+
+`inline fun &lt;T&gt; T.apply(f:&nbsp;T.()&nbsp;-&gt;&nbsp;Unit): T`
+
+
diff --git a/test/data/format/extensions.class.md b/test/data/format/extensions.class.md
index 33721e67..c66cdb01 100644
--- a/test/data/format/extensions.class.md
+++ b/test/data/format/extensions.class.md
@@ -1,15 +1,15 @@
-[test](test/index) / [foo](test/foo/index) / [String](test/foo/-string/index)
+[test](test/index) / [foo](test/foo/index) / [kotlin.String](test/foo/kotlin.-string/index)
-### Extensions for String
+### Extensions for kotlin.String
-| [fn](test/foo/-string/fn) | `fun String.fn(): Unit`
+| [fn](test/foo/kotlin.-string/fn) | `fun String.fn(): Unit`
`fun String.fn(x:&nbsp;Int): Unit`
Function with receiver
|
-| [foobar](test/foo/-string/foobar) | `val String.foobar: Int`
+| [foobar](test/foo/kotlin.-string/foobar) | `val String.foobar: Int`
Property with receiver.
|
diff --git a/test/data/format/extensions.package.md b/test/data/format/extensions.package.md
index 17829ba0..76ff3676 100644
--- a/test/data/format/extensions.package.md
+++ b/test/data/format/extensions.package.md
@@ -7,5 +7,5 @@
### Extensions for External Classes
-| [String](test/foo/-string/index) | |
+| [kotlin.String](test/foo/kotlin.-string/index) | |
diff --git a/test/data/format/inheritedExtensions.kt b/test/data/format/inheritedExtensions.kt
new file mode 100644
index 00000000..e38fe00d
--- /dev/null
+++ b/test/data/format/inheritedExtensions.kt
@@ -0,0 +1,11 @@
+open class Foo
+
+class Bar : Foo()
+
+fun Foo.first() {
+
+}
+
+fun Bar.second() {
+
+}
diff --git a/test/data/format/inheritedExtensions.md b/test/data/format/inheritedExtensions.md
new file mode 100644
index 00000000..79137eac
--- /dev/null
+++ b/test/data/format/inheritedExtensions.md
@@ -0,0 +1,21 @@
+[test](test/index) / [Bar](test/-bar/index)
+
+
+# Bar
+
+`class Bar&nbsp;:&nbsp;[Foo](test/-foo/index)`
+
+
+
+### Constructors
+
+
+| [&lt;init&gt;](test/-bar/-init-) | `Bar()` |
+
+
+### Extension Functions
+
+
+| [first](test/first) | `fun [Foo](test/-foo/index).first(): Unit` |
+| [second](test/second) | `fun [Bar](test/-bar/index).second(): Unit` |
+
diff --git a/test/data/format/inheritedMembers.kt b/test/data/format/inheritedMembers.kt
new file mode 100644
index 00000000..2d0c4ca1
--- /dev/null
+++ b/test/data/format/inheritedMembers.kt
@@ -0,0 +1,12 @@
+open class Foo {
+ fun first() {
+ }
+
+ val firstProp: Int = 0
+}
+
+class Bar : Foo() {
+ fun second()
+
+ val secondProp: Int = 1
+}
diff --git a/test/data/format/inheritedMembers.md b/test/data/format/inheritedMembers.md
new file mode 100644
index 00000000..d58d3974
--- /dev/null
+++ b/test/data/format/inheritedMembers.md
@@ -0,0 +1,38 @@
+[test](test/index) / [Bar](test/-bar/index)
+
+
+# Bar
+
+`class Bar&nbsp;:&nbsp;[Foo](test/-foo/index)`
+
+
+
+### Constructors
+
+
+| [&lt;init&gt;](test/-bar/-init-) | `Bar()` |
+
+
+### Properties
+
+
+| [secondProp](test/-bar/second-prop) | `val secondProp: Int` |
+
+
+### Inherited Properties
+
+
+| [firstProp](test/-foo/first-prop) | `val firstProp: Int` |
+
+
+### Functions
+
+
+| [second](test/-bar/second) | `fun second(): Unit` |
+
+
+### Inherited Functions
+
+
+| [first](test/-foo/first) | `fun first(): Unit` |
+
diff --git a/test/data/format/javaDeprecated.html b/test/data/format/javaDeprecated.html
index 8410e7ca..9e8958a2 100644
--- a/test/data/format/javaDeprecated.html
+++ b/test/data/format/javaDeprecated.html
@@ -6,7 +6,7 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/test/index">test</a>&nbsp;/&nbsp;<a href="test/test/-foo/index">Foo</a>&nbsp;/&nbsp;<a href="test/test/-foo/foo">foo</a><br/>
<br/>
<h1>foo</h1>
-<code><span class="keyword">public</span> <span class="keyword">open</span> <span class="keyword">fun </span><s><span class="identifier">foo</span></s><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">open</span> <span class="keyword">fun </span><s><span class="identifier">foo</span></s><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
<strong>Deprecated:</strong> use <code><a href="test/test/-foo/bar">#bar</a></code> instead <p></p>
<br/>
<br/>
diff --git a/test/data/format/javaSupertype.html b/test/data/format/javaSupertype.html
index 3a93da0a..2bcc2fce 100644
--- a/test/data/format/javaSupertype.html
+++ b/test/data/format/javaSupertype.html
@@ -6,7 +6,7 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/test/index">test</a>&nbsp;/&nbsp;<a href="test/test/-c/index">C</a>&nbsp;/&nbsp;<a href="test/test/-c/-bar/index">Bar</a><br/>
<br/>
<h1>Bar</h1>
-<code><span class="keyword">public</span> <span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Bar</span>&nbsp;<span class="symbol">:</span>&nbsp;<a href="test/test/-c/-foo"><span class="identifier">Foo</span></a></code><br/>
+<code><span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Bar</span>&nbsp;<span class="symbol">:</span>&nbsp;<a href="test/test/-c/-foo"><span class="identifier">Foo</span></a></code><br/>
<br/>
<br/>
<h3>Functions</h3>
diff --git a/test/data/format/javadocHtml.md b/test/data/format/javadocHtml.md
index 64b7a5a4..a75ebf35 100644
--- a/test/data/format/javadocHtml.md
+++ b/test/data/format/javadocHtml.md
@@ -3,7 +3,7 @@
# C
-`public open class C`
+`open class C`
**Bold** **Strong** *Italic* *Emphasized*
Paragraph
diff --git a/test/data/format/javadocOrderedList.md b/test/data/format/javadocOrderedList.md
index ba5935e2..acd3e809 100644
--- a/test/data/format/javadocOrderedList.md
+++ b/test/data/format/javadocOrderedList.md
@@ -3,7 +3,7 @@
# Bar
-`public open class Bar`
+`open class Bar`
1. Rinse
1. Repeat
diff --git a/test/data/format/operatorOverloading.md b/test/data/format/operatorOverloading.md
index fd0fa977..05fe3206 100644
--- a/test/data/format/operatorOverloading.md
+++ b/test/data/format/operatorOverloading.md
@@ -4,5 +4,5 @@
# plus
`fun plus(other:&nbsp;[C](test/-c/index)): [C](test/-c/index)`
-Implements **operator `+`**
+
diff --git a/test/data/format/orderedList.html b/test/data/format/orderedList.html
index 223684ff..9917568f 100644
--- a/test/data/format/orderedList.html
+++ b/test/data/format/orderedList.html
@@ -8,7 +8,6 @@
<h1>Bar</h1>
<code><span class="keyword">class </span><span class="identifier">Bar</span></code><br/>
<p>Usage instructions:</p>
-<h3>Description</h3>
<ol><li><p>Rinse</p>
</li><li><p>Repeat</p>
</li></ol><br/>
diff --git a/test/data/format/overloadsWithDescription.html b/test/data/format/overloadsWithDescription.html
index a0a27b8c..a0efb472 100644
--- a/test/data/format/overloadsWithDescription.html
+++ b/test/data/format/overloadsWithDescription.html
@@ -9,7 +9,6 @@
<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
<p>Performs an action on <a href="test/f#x">x</a>.</p>
-<h3>Description</h3>
<p>This is a long description.</p>
<br/>
<br/>
diff --git a/test/data/format/overloadsWithDifferentDescriptions.html b/test/data/format/overloadsWithDifferentDescriptions.html
index a2cc21f4..30a37e75 100644
--- a/test/data/format/overloadsWithDifferentDescriptions.html
+++ b/test/data/format/overloadsWithDifferentDescriptions.html
@@ -8,7 +8,6 @@
<h1>f</h1>
<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
<p>Performs an action on x.</p>
-<h3>Description</h3>
<p>This is a long description.</p>
<br/>
<br/>
@@ -19,7 +18,6 @@
<br/>
<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
<p>Performs an action on x.</p>
-<h3>Description</h3>
<p>This is a long description.</p>
<br/>
<br/>
diff --git a/test/data/format/parameterAnchor.html b/test/data/format/parameterAnchor.html
index 99f0f110..c5920fb7 100644
--- a/test/data/format/parameterAnchor.html
+++ b/test/data/format/parameterAnchor.html
@@ -6,7 +6,7 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/process-files">processFiles</a><br/>
<br/>
<h1>processFiles</h1>
-<code><span class="keyword">public</span> <span class="keyword">fun </span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span> <span class="identifier">processFiles</span><span class="symbol">(</span><span class="identifier">processor</span><span class="symbol">:</span>&nbsp;<span class="symbol">(</span><span class="symbol">)</span>&nbsp;<span class="symbol">-&gt;</span>&nbsp;<span class="identifier">T</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">List</span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span></code><br/>
+<code><span class="keyword">fun </span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span> <span class="identifier">processFiles</span><span class="symbol">(</span><span class="identifier">processor</span><span class="symbol">:</span>&nbsp;<span class="symbol">(</span><span class="symbol">)</span>&nbsp;<span class="symbol">-&gt;</span>&nbsp;<span class="identifier">T</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">List</span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span></code><br/>
<p>Runs <a href="test/process-files#processor">processor</a> for each file and collects its results into single list</p>
<h3>Parameters</h3>
<a name="processor"></a>
diff --git a/test/data/format/reifiedTypeParameter.kt b/test/data/format/reifiedTypeParameter.kt
new file mode 100644
index 00000000..00fa1dc9
--- /dev/null
+++ b/test/data/format/reifiedTypeParameter.kt
@@ -0,0 +1,3 @@
+inline fun f<reified T>() {
+
+}
diff --git a/test/data/format/reifiedTypeParameter.md b/test/data/format/reifiedTypeParameter.md
new file mode 100644
index 00000000..2e96018e
--- /dev/null
+++ b/test/data/format/reifiedTypeParameter.md
@@ -0,0 +1,8 @@
+[test](test/index) / [f](test/f)
+
+
+# f
+
+`inline fun &lt;reified&nbsp;T&gt; f(): Unit`
+
+
diff --git a/test/data/format/starProjection.kt b/test/data/format/starProjection.kt
new file mode 100644
index 00000000..48d53e47
--- /dev/null
+++ b/test/data/format/starProjection.kt
@@ -0,0 +1,3 @@
+public fun Iterable<*>.containsFoo(element: Any?): Boolean {
+ return false
+}
diff --git a/test/data/format/starProjection.md b/test/data/format/starProjection.md
new file mode 100644
index 00000000..c9be2f58
--- /dev/null
+++ b/test/data/format/starProjection.md
@@ -0,0 +1,8 @@
+[test](test/index) / [kotlin.Iterable](test/kotlin.-iterable/index)
+
+
+### Extensions for kotlin.Iterable
+
+
+| [containsFoo](test/kotlin.-iterable/contains-foo) | `fun Iterable&lt;*&gt;.containsFoo(element:&nbsp;Any?): Boolean` |
+
diff --git a/test/data/format/summarizeSignatures.kt b/test/data/format/summarizeSignatures.kt
new file mode 100644
index 00000000..1d875a50
--- /dev/null
+++ b/test/data/format/summarizeSignatures.kt
@@ -0,0 +1,20 @@
+package kotlin
+
+class Array<T>
+class IntArray
+class CharArray
+
+/**
+ * Returns true if foo.
+ */
+fun IntArray.foo(predicate: (Int) -> Boolean): Boolean = false
+
+/**
+ * Returns true if foo.
+ */
+fun CharArray.foo(predicate: (Char) -> Boolean): Boolean = false
+
+/**
+ * Returns true if foo.
+ */
+fun <T> Array<T>.foo(predicate: (T) -> Boolean): Boolean = false
diff --git a/test/data/format/summarizeSignatures.md b/test/data/format/summarizeSignatures.md
new file mode 100644
index 00000000..b1707f40
--- /dev/null
+++ b/test/data/format/summarizeSignatures.md
@@ -0,0 +1,23 @@
+[test](test/index) / [kotlin](test/kotlin/index)
+
+
+## Package kotlin
+
+
+### Types
+
+
+| [Array](test/kotlin/-array/index) | `class Array&lt;T&gt;` |
+| [CharArray](test/kotlin/-char-array/index) | `class CharArray` |
+| [IntArray](test/kotlin/-int-array/index) | `class IntArray` |
+
+
+### Functions
+
+
+| [foo](test/kotlin/foo) | `fun &lt;T&gt; any_array&lt;T&gt;.foo(predicate:&nbsp;(T)&nbsp;-&gt;&nbsp;Boolean): Boolean`
+
+Returns true if foo.
+
+ |
+
diff --git a/test/data/format/summarizeSignaturesProperty.kt b/test/data/format/summarizeSignaturesProperty.kt
new file mode 100644
index 00000000..fbbdd328
--- /dev/null
+++ b/test/data/format/summarizeSignaturesProperty.kt
@@ -0,0 +1,20 @@
+package kotlin
+
+class Array<T>
+class IntArray
+class CharArray
+
+/**
+ * Returns true if foo.
+ */
+val IntArray.foo: Int = 0
+
+/**
+ * Returns true if foo.
+ */
+val CharArray.foo: Int = 0
+
+/**
+ * Returns true if foo.
+ */
+val <T> Array<T>.foo: Int = 0
diff --git a/test/data/format/summarizeSignaturesProperty.md b/test/data/format/summarizeSignaturesProperty.md
new file mode 100644
index 00000000..9646b0f1
--- /dev/null
+++ b/test/data/format/summarizeSignaturesProperty.md
@@ -0,0 +1,23 @@
+[test](test/index) / [kotlin](test/kotlin/index)
+
+
+## Package kotlin
+
+
+### Types
+
+
+| [Array](test/kotlin/-array/index) | `class Array&lt;T&gt;` |
+| [CharArray](test/kotlin/-char-array/index) | `class CharArray` |
+| [IntArray](test/kotlin/-int-array/index) | `class IntArray` |
+
+
+### Properties
+
+
+| [foo](test/kotlin/foo) | `val &lt;T&gt; any_array&lt;T&gt;.foo: Int`
+
+Returns true if foo.
+
+ |
+
diff --git a/test/data/format/tripleBackticks.html b/test/data/format/tripleBackticks.html
index 76b5f9e1..13954985 100644
--- a/test/data/format/tripleBackticks.html
+++ b/test/data/format/tripleBackticks.html
@@ -8,7 +8,6 @@
<h1>f</h1>
<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
<p>Description</p>
-<h3>Description</h3>
<pre><code>code sample</code></pre><br/>
<br/>
<br/>
diff --git a/test/data/format/typeParameterBounds.md b/test/data/format/typeParameterBounds.md
index 3962f911..fe597878 100644
--- a/test/data/format/typeParameterBounds.md
+++ b/test/data/format/typeParameterBounds.md
@@ -3,7 +3,7 @@
# generic
-`public fun &lt;T&nbsp;:&nbsp;R, R&gt; generic(): Unit`
+`fun &lt;T&nbsp;:&nbsp;R, R&gt; generic(): Unit`
generic function
diff --git a/test/data/format/typeProjectionVariance.md b/test/data/format/typeProjectionVariance.md
index 9812ca3f..7aa34593 100644
--- a/test/data/format/typeProjectionVariance.md
+++ b/test/data/format/typeProjectionVariance.md
@@ -1,8 +1,8 @@
-[test](test/index) / [Array](test/-array/index)
+[test](test/index) / [kotlin.Array](test/kotlin.-array/index)
-### Extensions for Array
+### Extensions for kotlin.Array
-| [foo](test/-array/foo) | `fun &lt;T&gt; Array&lt;out&nbsp;T&gt;.foo(): Unit` |
+| [foo](test/kotlin.-array/foo) | `fun &lt;T&gt; Array&lt;out&nbsp;T&gt;.foo(): Unit` |
diff --git a/test/data/functions/annotatedFunction.kt b/test/data/functions/annotatedFunction.kt
index 11c19672..f7abbf6c 100644
--- a/test/data/functions/annotatedFunction.kt
+++ b/test/data/functions/annotatedFunction.kt
@@ -1,2 +1,2 @@
-inline fun f() {
+@Strictfp fun f() {
}
diff --git a/test/data/functions/annotatedFunctionWithAnnotationParameters.kt b/test/data/functions/annotatedFunctionWithAnnotationParameters.kt
index ee5b524a..e559713a 100644
--- a/test/data/functions/annotatedFunctionWithAnnotationParameters.kt
+++ b/test/data/functions/annotatedFunctionWithAnnotationParameters.kt
@@ -1 +1,7 @@
-inlineOptions(InlineOption.LOCAL_CONTINUE_AND_BREAK) fun f() {}
+@Target(AnnotationTarget.VALUE_PARAMETER)
+@Retention(AnnotationRetention.SOURCE)
+@MustBeDocumented
+public annotation class Fancy(val size: Int)
+
+
+@Fancy(1) fun f() {}
diff --git a/test/data/functions/functionWithAnnotatedParam.kt b/test/data/functions/functionWithAnnotatedParam.kt
index 640bec83..f858e671 100644
--- a/test/data/functions/functionWithAnnotatedParam.kt
+++ b/test/data/functions/functionWithAnnotatedParam.kt
@@ -1,2 +1,7 @@
-fun function(noinline notInlined: () -> Unit) {
+@Target(AnnotationTarget.VALUE_PARAMETER)
+@Retention(AnnotationRetention.SOURCE)
+@MustBeDocumented
+public annotation class Fancy
+
+fun function(@Fancy notInlined: () -> Unit) {
}
diff --git a/test/data/functions/functionWithNoinlineParam.kt b/test/data/functions/functionWithNoinlineParam.kt
new file mode 100644
index 00000000..640bec83
--- /dev/null
+++ b/test/data/functions/functionWithNoinlineParam.kt
@@ -0,0 +1,2 @@
+fun function(noinline notInlined: () -> Unit) {
+}
diff --git a/test/data/functions/functionWithNotDocumentedAnnotation.kt b/test/data/functions/functionWithNotDocumentedAnnotation.kt
new file mode 100644
index 00000000..3c7e2ff9
--- /dev/null
+++ b/test/data/functions/functionWithNotDocumentedAnnotation.kt
@@ -0,0 +1,2 @@
+@Suppress("FOO") fun f() {
+}
diff --git a/test/data/functions/inlineFunction.kt b/test/data/functions/inlineFunction.kt
new file mode 100644
index 00000000..11c19672
--- /dev/null
+++ b/test/data/functions/inlineFunction.kt
@@ -0,0 +1,2 @@
+inline fun f() {
+}
diff --git a/test/data/packagedocs/stdlib.md b/test/data/packagedocs/stdlib.md
new file mode 100644
index 00000000..5d7432b5
--- /dev/null
+++ b/test/data/packagedocs/stdlib.md
@@ -0,0 +1,11 @@
+# Module stdlib
+
+## Kotlin Standard Library
+
+The Kotlin standard library is a set of functions and types implementing idiomatic patterns when working with collections,
+text and files.
+
+# Package kotlin
+
+Core functions and types
+
diff --git a/test/data/properties/annotatedProperty.kt b/test/data/properties/annotatedProperty.kt
index f70c28b4..8990af29 100644
--- a/test/data/properties/annotatedProperty.kt
+++ b/test/data/properties/annotatedProperty.kt
@@ -1 +1 @@
-inline val property = "test" \ No newline at end of file
+@Volatile var property = "test" \ No newline at end of file
diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt
index 165278f9..59b6495b 100644
--- a/test/src/TestAPI.kt
+++ b/test/src/TestAPI.kt
@@ -9,12 +9,14 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot
import org.jetbrains.kotlin.config.ContentRoot
import org.jetbrains.kotlin.config.KotlinSourceRoot
-import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
import org.junit.Assert
import java.io.File
import kotlin.test.fail
-public fun verifyModel(vararg roots: ContentRoot, verifier: (DocumentationModule) -> Unit) {
+public fun verifyModel(vararg roots: ContentRoot,
+ withJdk: Boolean = false,
+ withKotlinRuntime: Boolean = false,
+ verifier: (DocumentationModule) -> Unit) {
val messageCollector = object : MessageCollector {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation) {
when (severity) {
@@ -33,8 +35,14 @@ public fun verifyModel(vararg roots: ContentRoot, verifier: (DocumentationModule
}
val environment = AnalysisEnvironment(messageCollector) {
- val stringRoot = PathManager.getResourceRoot(javaClass<String>(), "/java/lang/String.class")
- addClasspath(File(stringRoot))
+ if (withJdk || withKotlinRuntime) {
+ val stringRoot = PathManager.getResourceRoot(String::class.java, "/java/lang/String.class")
+ addClasspath(File(stringRoot))
+ }
+ if (withKotlinRuntime) {
+ val kotlinPairRoot = PathManager.getResourceRoot(Pair::class.java, "/kotlin/Pair.class")
+ addClasspath(File(kotlinPairRoot))
+ }
addRoots(roots.toList())
}
val options = DocumentationOptions(includeNonPublic = true, skipEmptyPackages = false, sourceLinks = listOf<SourceLinkDefinition>())
@@ -43,19 +51,29 @@ public fun verifyModel(vararg roots: ContentRoot, verifier: (DocumentationModule
Disposer.dispose(environment)
}
-public fun verifyModel(source: String, verifier: (DocumentationModule) -> Unit) {
- verifyModel(contentRootFromPath(source), verifier = verifier)
+public fun verifyModel(source: String,
+ withJdk: Boolean = false,
+ withKotlinRuntime: Boolean = false,
+ verifier: (DocumentationModule) -> Unit) {
+ verifyModel(contentRootFromPath(source), withJdk = withJdk, withKotlinRuntime = withKotlinRuntime, verifier = verifier)
}
-public fun verifyPackageMember(kotlinSource: String, verifier: (DocumentationNode) -> Unit) {
- verifyModel(kotlinSource) { model ->
+public fun verifyPackageMember(kotlinSource: String,
+ withJdk: Boolean = false,
+ withKotlinRuntime: Boolean = false,
+ verifier: (DocumentationNode) -> Unit) {
+ verifyModel(kotlinSource, withJdk = withJdk, withKotlinRuntime = withKotlinRuntime) { model ->
val pkg = model.members.single()
verifier(pkg.members.single())
}
}
-public fun verifyOutput(roots: Array<ContentRoot>, outputExtension: String, outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
- verifyModel(*roots) {
+public fun verifyOutput(roots: Array<ContentRoot>,
+ outputExtension: String,
+ withJdk: Boolean = false,
+ withKotlinRuntime: Boolean = false,
+ outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
+ verifyModel(*roots, withJdk = withJdk, withKotlinRuntime = withKotlinRuntime) {
val output = StringBuilder()
outputGenerator(it, output)
val ext = outputExtension.removePrefix(".")
@@ -65,8 +83,12 @@ public fun verifyOutput(roots: Array<ContentRoot>, outputExtension: String, outp
}
}
-public fun verifyOutput(path: String, outputExtension: String, outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
- verifyOutput(arrayOf(contentRootFromPath(path)), outputExtension, outputGenerator)
+public fun verifyOutput(path: String,
+ outputExtension: String,
+ withJdk: Boolean = false,
+ withKotlinRuntime: Boolean = false,
+ outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
+ verifyOutput(arrayOf(contentRootFromPath(path)), outputExtension, withJdk, withKotlinRuntime, outputGenerator)
}
public fun assertEqualsIgnoringSeparators(expectedOutput: String, output: String) {
@@ -110,7 +132,7 @@ fun StringBuilder.appendNode(node: ContentNode): StringBuilder {
fun ContentNode.toTestString(): String {
val node = this
- return StringBuilder {
+ return StringBuilder().apply {
appendNode(node)
}.toString()
}
diff --git a/test/src/format/HtmlFormatTest.kt b/test/src/format/HtmlFormatTest.kt
index b7fef79f..66fd0fee 100644
--- a/test/src/format/HtmlFormatTest.kt
+++ b/test/src/format/HtmlFormatTest.kt
@@ -11,37 +11,37 @@ import java.io.File
public class HtmlFormatTest {
private val htmlService = HtmlFormatService(InMemoryLocationService, KotlinLanguageService(), HtmlTemplateService.default())
- Test fun classWithCompanionObject() {
+ @Test fun classWithCompanionObject() {
verifyOutput("test/data/format/classWithCompanionObject.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun htmlEscaping() {
+ @Test fun htmlEscaping() {
verifyOutput("test/data/format/htmlEscaping.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun overloads() {
+ @Test fun overloads() {
verifyOutput("test/data/format/overloads.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members)
}
}
- Test fun overloadsWithDescription() {
+ @Test fun overloadsWithDescription() {
verifyOutput("test/data/format/overloadsWithDescription.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun overloadsWithDifferentDescriptions() {
+ @Test fun overloadsWithDifferentDescriptions() {
verifyOutput("test/data/format/overloadsWithDifferentDescriptions.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun deprecated() {
+ @Test fun deprecated() {
verifyOutput("test/data/format/deprecated.kt", ".package.html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members)
}
@@ -50,85 +50,85 @@ public class HtmlFormatTest {
}
}
- Test fun brokenLink() {
+ @Test fun brokenLink() {
verifyOutput("test/data/format/brokenLink.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun codeSpan() {
+ @Test fun codeSpan() {
verifyOutput("test/data/format/codeSpan.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun parenthesis() {
+ @Test fun parenthesis() {
verifyOutput("test/data/format/parenthesis.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun bracket() {
+ @Test fun bracket() {
verifyOutput("test/data/format/bracket.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun see() {
+ @Test fun see() {
verifyOutput("test/data/format/see.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun tripleBackticks() {
+ @Test fun tripleBackticks() {
verifyOutput("test/data/format/tripleBackticks.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun typeLink() {
+ @Test fun typeLink() {
verifyOutput("test/data/format/typeLink.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar"} )
}
}
- Test fun parameterAnchor() {
+ @Test fun parameterAnchor() {
verifyOutput("test/data/format/parameterAnchor.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun javaSupertypeLink() {
+ @Test fun javaSupertypeLink() {
verifyOutput("test/data/format/javaSupertype.java", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members.single { it.name == "C"}.members.filter { it.name == "Bar"} )
}
}
- Test fun javaLinkTag() {
- verifyOutput("test/data/format/javaLinkTag.java", ".html") { model, output ->
+ @Test fun javaLinkTag() {
+ verifyOutput("test/data/format/javaLinkTag.java", ".html", withJdk = true) { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun javaLinkTagWithLabel() {
- verifyOutput("test/data/format/javaLinkTagWithLabel.java", ".html") { model, output ->
+ @Test fun javaLinkTagWithLabel() {
+ verifyOutput("test/data/format/javaLinkTagWithLabel.java", ".html", withJdk = true) { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun javaSeeTag() {
- verifyOutput("test/data/format/javaSeeTag.java", ".html") { model, output ->
+ @Test fun javaSeeTag() {
+ verifyOutput("test/data/format/javaSeeTag.java", ".html", withJdk = true) { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun javaDeprecated() {
+ @Test fun javaDeprecated() {
verifyOutput("test/data/format/javaDeprecated.java", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members.single { it.name == "Foo" }.members.filter { it.name == "foo" })
}
}
- Test fun crossLanguageKotlinExtendsJava() {
+ @Test fun crossLanguageKotlinExtendsJava() {
verifyOutput(arrayOf(KotlinSourceRoot("test/data/format/crossLanguage/kotlinExtendsJava/Bar.kt"),
JavaSourceRoot(File("test/data/format/crossLanguage/kotlinExtendsJava"))),
".html") { model, output ->
@@ -136,19 +136,19 @@ public class HtmlFormatTest {
}
}
- Test fun orderedList() {
+ @Test fun orderedList() {
verifyOutput("test/data/format/orderedList.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" })
}
}
- Test fun linkWithLabel() {
+ @Test fun linkWithLabel() {
verifyOutput("test/data/format/linkWithLabel.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" })
}
}
- Test fun entity() {
+ @Test fun entity() {
verifyOutput("test/data/format/entity.kt", ".html") { model, output ->
htmlService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" })
}
diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt
index 059b491b..bb61fa1c 100644
--- a/test/src/format/MarkdownFormatTest.kt
+++ b/test/src/format/MarkdownFormatTest.kt
@@ -1,42 +1,43 @@
package org.jetbrains.dokka.tests
+import org.jetbrains.dokka.KotlinLanguageService
+import org.jetbrains.dokka.MarkdownFormatService
import org.junit.Test
-import org.jetbrains.dokka.*
public class MarkdownFormatTest {
private val markdownService = MarkdownFormatService(InMemoryLocationService, KotlinLanguageService())
- Test fun emptyDescription() {
+ @Test fun emptyDescription() {
verifyOutput("test/data/format/emptyDescription.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun classWithCompanionObject() {
+ @Test fun classWithCompanionObject() {
verifyOutput("test/data/format/classWithCompanionObject.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun annotations() {
+ @Test fun annotations() {
verifyOutput("test/data/format/annotations.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun annotationClass() {
+ @Test fun annotationClass() {
verifyOutput("test/data/format/annotationClass.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun annotationParams() {
- verifyOutput("test/data/format/annotationParams.kt", ".md") { model, output ->
+ @Test fun annotationParams() {
+ verifyOutput("test/data/format/annotationParams.kt", ".md", withKotlinRuntime = true) { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun extensions() {
+ @Test fun extensions() {
verifyOutput("test/data/format/extensions.kt", ".package.md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members)
}
@@ -45,7 +46,7 @@ public class MarkdownFormatTest {
}
}
- Test fun enumClass() {
+ @Test fun enumClass() {
verifyOutput("test/data/format/enumClass.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
@@ -56,13 +57,13 @@ public class MarkdownFormatTest {
}
}
- Test fun varargsFunction() {
+ @Test fun varargsFunction() {
verifyOutput("test/data/format/varargsFunction.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun overridingFunction() {
+ @Test fun overridingFunction() {
verifyOutput("test/data/format/overridingFunction.kt", ".md") { model, output ->
val classMembers = model.members.single().members.first { it.name == "D" }.members
markdownService.appendNodes(tempLocation, output, classMembers.filter { it.name == "f" })
@@ -70,100 +71,148 @@ public class MarkdownFormatTest {
}
- Test fun propertyVar() {
+ @Test fun propertyVar() {
verifyOutput("test/data/format/propertyVar.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun functionWithDefaultParameter() {
+ @Test fun functionWithDefaultParameter() {
verifyOutput("test/data/format/functionWithDefaultParameter.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun accessor() {
+ @Test fun accessor() {
verifyOutput("test/data/format/accessor.kt", ".md") { model, output ->
val propertyNode = model.members.single().members.first { it.name == "C" }.members.filter { it.name == "x" }
markdownService.appendNodes(tempLocation, output, propertyNode)
}
}
- Test fun paramTag() {
+ @Test fun paramTag() {
verifyOutput("test/data/format/paramTag.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun throwsTag() {
+ @Test fun throwsTag() {
verifyOutput("test/data/format/throwsTag.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun typeParameterBounds() {
+ @Test fun typeParameterBounds() {
verifyOutput("test/data/format/typeParameterBounds.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun typeParameterVariance() {
+ @Test fun typeParameterVariance() {
verifyOutput("test/data/format/typeParameterVariance.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun typeProjectionVariance() {
+ @Test fun typeProjectionVariance() {
verifyOutput("test/data/format/typeProjectionVariance.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun javadocHtml() {
- verifyOutput("test/data/format/javadocHtml.java", ".md") { model, output ->
+ @Test fun javadocHtml() {
+ verifyOutput("test/data/format/javadocHtml.java", ".md", withJdk = true) { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun javaCodeLiteralTags() {
- verifyOutput("test/data/format/javaCodeLiteralTags.java", ".md") { model, output ->
+ @Test fun javaCodeLiteralTags() {
+ verifyOutput("test/data/format/javaCodeLiteralTags.java", ".md", withJdk = true) { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun javaCodeInParam() {
- verifyOutput("test/data/format/javaCodeInParam.java", ".md") { model, output ->
+ @Test fun javaCodeInParam() {
+ verifyOutput("test/data/format/javaCodeInParam.java", ".md", withJdk = true) { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun javaSpaceInAuthor() {
- verifyOutput("test/data/format/javaSpaceInAuthor.java", ".md") { model, output ->
+ @Test fun javaSpaceInAuthor() {
+ verifyOutput("test/data/format/javaSpaceInAuthor.java", ".md", withJdk = true) { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun nullability() {
+ @Test fun nullability() {
verifyOutput("test/data/format/nullability.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
- Test fun operatorOverloading() {
+ @Test fun operatorOverloading() {
verifyOutput("test/data/format/operatorOverloading.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members.single { it.name == "C" }.members.filter { it.name == "plus" })
}
}
- Test fun javadocOrderedList() {
- verifyOutput("test/data/format/javadocOrderedList.java", ".md") { model, output ->
+ @Test fun javadocOrderedList() {
+ verifyOutput("test/data/format/javadocOrderedList.java", ".md", withJdk = true) { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" })
}
}
- Test fun companionObjectExtension() {
+ @Test fun companionObjectExtension() {
verifyOutput("test/data/format/companionObjectExtension.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Foo" })
}
}
+
+ @Test fun starProjection() {
+ verifyOutput("test/data/format/starProjection.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
+
+ @Test fun extensionFunctionParameter() {
+ verifyOutput("test/data/format/extensionFunctionParameter.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
+
+ @Test fun summarizeSignatures() {
+ verifyOutput("test/data/format/summarizeSignatures.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members)
+ }
+ }
+
+ @Test fun summarizeSignaturesProperty() {
+ verifyOutput("test/data/format/summarizeSignaturesProperty.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members)
+ }
+ }
+
+ @Test fun reifiedTypeParameter() {
+ verifyOutput("test/data/format/reifiedTypeParameter.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
+
+ @Test fun annotatedTypeParameter() {
+ verifyOutput("test/data/format/annotatedTypeParameter.kt", ".md", withKotlinRuntime = true) { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
+
+ @Test fun inheritedMembers() {
+ verifyOutput("test/data/format/inheritedMembers.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" })
+ }
+ }
+
+ @Test fun inheritedExtensions() {
+ verifyOutput("test/data/format/inheritedExtensions.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" })
+ }
+ }
}
diff --git a/test/src/format/PackageDocsTest.kt b/test/src/format/PackageDocsTest.kt
new file mode 100644
index 00000000..6815de6f
--- /dev/null
+++ b/test/src/format/PackageDocsTest.kt
@@ -0,0 +1,18 @@
+package org.jetbrains.dokka.tests.format
+
+import org.jetbrains.dokka.ContentBlock
+import org.jetbrains.dokka.ContentText
+import org.jetbrains.dokka.DokkaConsoleLogger
+import org.jetbrains.dokka.PackageDocs
+import org.junit.Test
+import kotlin.test.assertEquals
+
+public class PackageDocsTest {
+ @Test fun verifyParse() {
+ val docs = PackageDocs(null, null, DokkaConsoleLogger)
+ docs.parse("test/data/packagedocs/stdlib.md")
+ val packageContent = docs.packageContent["kotlin"]!!
+ val block = (packageContent.children.single() as ContentBlock).children.first() as ContentText
+ assertEquals("Core functions and types", block.text)
+ }
+}
diff --git a/test/src/markdown/MarkdownTestRunner.kt b/test/src/markdown/MarkdownTestRunner.kt
deleted file mode 100644
index 5ad0224f..00000000
--- a/test/src/markdown/MarkdownTestRunner.kt
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.jetbrains.kmark.test
-
-import org.junit.runner.*
-import org.junit.runner.notification.*
-import java.io.File
-import org.junit.runners.ParentRunner
-import java.io.Serializable
-import kotlin.properties.Delegates
-import org.junit.ComparisonFailure
-
-data class MarkdownTestUniqueId(val id: Int) : Serializable {
- companion object {
- var id = 0
- fun next() = MarkdownTestUniqueId(id++)
- }
-}
-
-public open class MarkdownSpecification(val path: String, val processor: (String) -> String)
-
-
-interface MarkdownTest {
- fun description(): Description
-}
-
-public open class MarkdownTestCase(val spec: MarkdownSpecification, val input: String, val expected: String) : MarkdownTest, Runner() {
- val _description by lazy {
- Description.createSuiteDescription(input, MarkdownTestUniqueId.next())!!
- }
-
- override fun description(): Description = _description
-
- override fun getDescription(): Description? = description()
- override fun run(notifier: RunNotifier?) {
- notifier!!
-
- notifier.fireTestStarted(_description)
- val result = spec.processor(input)
- when (result) {
- expected -> notifier.fireTestFinished(_description)
- else -> notifier.fireTestFailure(Failure(_description, ComparisonFailure("Output mismatch", expected, result)))
- }
- }
-}
-
-public open class MarkdownTestSection(val spec: MarkdownSpecification, val title: String) : MarkdownTest, ParentRunner<MarkdownTest>(spec.javaClass) {
- val children = arrayListOf<MarkdownTest>();
-
- val _description by lazy {
- val desc = Description.createSuiteDescription(title, MarkdownTestUniqueId.next())!!
- for (item in getChildren()!!) {
- desc.addChild(describeChild(item))
- }
- desc
- }
-
- override fun description(): Description = _description
-
- override fun getChildren(): MutableList<MarkdownTest>? = children
-
- override fun describeChild(child: MarkdownTest?): Description? = child!!.description()
-
- override fun runChild(child: MarkdownTest?, notifier: RunNotifier?) {
- notifier!!
- when (child) {
- is MarkdownTestCase -> child.run(notifier)
- is MarkdownTestSection -> {
- if (child.children.size() == 0) {
- notifier.fireTestStarted(child.description())
- notifier.fireTestFinished(child.description())
- } else {
- child.run(notifier)
- }
- }
- }
- }
-}
-
-public class MarkdownTestRunner(specificationClass: Class<MarkdownSpecification>) : MarkdownTestSection(specificationClass.newInstance(), "Tests") {
- init {
- val lines = File(spec.path).readLines()
- createSections(this, lines, 1)
- }
-
- private fun createTests(parent: MarkdownTestSection, lines: List<String>): Int {
- val testMark = lines.takeWhile { it.trim() != "." }
- val testHtml = lines.drop(testMark.size()).drop(1).takeWhile { it.trim() != "." }
- val markdown = testMark.join("\n", postfix = "\n", prefix = "\n")
- val html = testHtml.join("\n", postfix = "\n")
- val markdownTestCase = MarkdownTestCase(spec, markdown, html)
- parent.children.add(markdownTestCase)
- return testMark.size() + testHtml.size() + 3
- }
-
- private fun createSections(parent: MarkdownTestSection, lines: List<String>, level: Int): Int {
- var sectionNumber = 1
- var index = 0
- while (index < lines.size()) {
- val line = lines[index]
-
- if (line.trim() == ".") {
- index = createTests(parent, lines.subList(index + 1, lines.lastIndex)) + index + 1
- continue
- }
-
- val head = line.takeWhile { it == '#' }.length()
- if (head == 0) {
- index++
- continue
- }
-
- if (head < level) {
- return index
- }
-
- if (head == level) {
- val title = lines[index].dropWhile { it == '#' }.dropWhile { it.isWhitespace() }
- sectionNumber++
- val section = MarkdownTestSection(spec, title)
- val lastIndex = createSections(section, lines.subList(index + 1, lines.lastIndex), level + 1) + index + 1
- if (section.children.size() > 0)
- parent.children.add(section)
- val nextHead = lines[lastIndex].takeWhile { it == '#' }.length()
- if (nextHead < level) {
- return lastIndex
- }
- index = lastIndex
- continue
- }
- index++
- }
- return lines.size()
- }
-} \ No newline at end of file
diff --git a/test/src/markdown/ParserTest.kt b/test/src/markdown/ParserTest.kt
index 50c18f08..5a7adf05 100644
--- a/test/src/markdown/ParserTest.kt
+++ b/test/src/markdown/ParserTest.kt
@@ -1,12 +1,11 @@
package org.jetbrains.dokka.tests
import org.junit.Test
-import org.jetbrains.dokka
import org.jetbrains.dokka.toTestString
import org.jetbrains.dokka.parseMarkdown
import org.junit.Ignore
-Ignore public class ParserTest {
+@Ignore public class ParserTest {
fun runTestFor(text : String) {
println("MD: ---")
println(text)
@@ -16,27 +15,27 @@ Ignore public class ParserTest {
println()
}
- Test fun text() {
+ @Test fun text() {
runTestFor("text")
}
- Test fun textWithSpaces() {
+ @Test fun textWithSpaces() {
runTestFor("text and string")
}
- Test fun textWithColon() {
+ @Test fun textWithColon() {
runTestFor("text and string: cool!")
}
- Test fun link() {
+ @Test fun link() {
runTestFor("text [links]")
}
- Test fun linkWithHref() {
+ @Test fun linkWithHref() {
runTestFor("text [links](http://google.com)")
}
- Test fun multiline() {
+ @Test fun multiline() {
runTestFor(
"""
text
@@ -45,7 +44,7 @@ string
""")
}
- Test fun para() {
+ @Test fun para() {
runTestFor(
"""
paragraph number
@@ -56,14 +55,14 @@ number two
""")
}
- Test fun bulletList() {
+ @Test fun bulletList() {
runTestFor(
"""* list item 1
* list item 2
""")
}
- Test fun bulletListWithLines() {
+ @Test fun bulletListWithLines() {
runTestFor(
"""
* list item 1
@@ -73,7 +72,7 @@ number two
""")
}
- Test fun bulletListStrong() {
+ @Test fun bulletListStrong() {
runTestFor(
"""
* list *item* 1
@@ -83,47 +82,47 @@ number two
""")
}
- Test fun emph() {
+ @Test fun emph() {
runTestFor("*text*")
}
- Test fun directive() {
+ @Test fun directive() {
runTestFor("A text \${code with.another.value} with directive")
}
- Test fun emphAndEmptySection() {
+ @Test fun emphAndEmptySection() {
runTestFor("*text*\n\$sec:\n")
}
- Test fun emphAndSection() {
+ @Test fun emphAndSection() {
runTestFor("*text*\n\$sec: some text\n")
}
- Test fun emphAndBracedSection() {
+ @Test fun emphAndBracedSection() {
runTestFor("Text *bold* text \n\${sec}: some text")
}
- Test fun section() {
+ @Test fun section() {
runTestFor(
"Plain text \n\$one: Summary \n\${two}: Description with *emphasis* \n\${An example of a section}: Example")
}
- Test fun anonymousSection() {
+ @Test fun anonymousSection() {
runTestFor("Summary\n\nDescription\n")
}
- Test fun specialSection() {
+ @Test fun specialSection() {
runTestFor(
"Plain text \n\$\$summary: Summary \n\${\$description}: Description \n\${\$An example of a section}: Example")
}
- Test fun emptySection() {
+ @Test fun emptySection() {
runTestFor(
"Plain text \n\$summary:")
}
val b = "$"
- Test fun pair() {
+ @Test fun pair() {
runTestFor(
"""Represents a generic pair of two values.
diff --git a/test/src/markdown/Specification.kt b/test/src/markdown/Specification.kt
deleted file mode 100644
index 429317c2..00000000
--- a/test/src/markdown/Specification.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.jetbrains.kmark.test
-
-import org.junit.runner.*
-import org.jetbrains.kmark.test.*
-import org.jetbrains.dokka.*
-
-//[RunWith(javaClass<MarkdownTestRunner>())]
-class Specification : MarkdownSpecification("test/data/markdown/spec.txt", {
-// markdownToHtml(it.replace("→", "\t"))
- ""
-}) \ No newline at end of file
diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt
index 6eec91cc..ce4b4683 100644
--- a/test/src/model/ClassTest.kt
+++ b/test/src/model/ClassTest.kt
@@ -1,43 +1,43 @@
package org.jetbrains.dokka.tests
+import org.jetbrains.dokka.Content
+import org.jetbrains.dokka.DocumentationNode
+import org.jetbrains.dokka.DocumentationReference
import org.junit.Test
-import kotlin.test.*
-import org.jetbrains.dokka.*
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
public class ClassTest {
- Test fun emptyClass() {
+ @Test fun emptyClass() {
verifyModel("test/data/classes/emptyClass.kt") { model ->
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
- assertEquals(2, details.count())
assertEquals("<init>", members.single().name)
assertTrue(links.none())
}
}
}
- Test fun emptyObject() {
+ @Test fun emptyObject() {
verifyModel("test/data/classes/emptyObject.kt") { model ->
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Object, kind)
assertEquals("Obj", name)
assertEquals(Content.Empty, content)
- assertEquals(2, details.count())
assertTrue(members.none())
assertTrue(links.none())
}
}
}
- Test fun classWithConstructor() {
+ @Test fun classWithConstructor() {
verifyModel("test/data/classes/classWithConstructor.kt") { model ->
with (model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
- assertEquals(2, details.count())
assertTrue(links.none())
assertEquals(1, members.count())
@@ -62,13 +62,12 @@ public class ClassTest {
}
}
- Test fun classWithFunction() {
+ @Test fun classWithFunction() {
verifyModel("test/data/classes/classWithFunction.kt") { model ->
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
- assertEquals(2, details.count())
assertTrue(links.none())
assertEquals(2, members.count())
@@ -93,13 +92,12 @@ public class ClassTest {
}
}
- Test fun classWithProperty() {
+ @Test fun classWithProperty() {
verifyModel("test/data/classes/classWithProperty.kt") { model ->
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
- assertEquals(2, details.count())
assertTrue(links.none())
assertEquals(2, members.count())
@@ -124,13 +122,12 @@ public class ClassTest {
}
}
- Test fun classWithCompanionObject() {
+ @Test fun classWithCompanionObject() {
verifyModel("test/data/classes/classWithCompanionObject.kt") { model ->
with(model.members.single().members.single()) {
assertEquals(DocumentationNode.Kind.Class, kind)
assertEquals("Klass", name)
assertEquals(Content.Empty, content)
- assertEquals(2, details.count())
assertTrue(links.none())
assertEquals(3, members.count())
@@ -154,24 +151,36 @@ public class ClassTest {
}
}
- Test fun annotatedClass() {
- verifyModel("test/data/classes/annotatedClass.kt") { model ->
- with(model.members.single().members.single()) {
- assertEquals(1, annotations.count())
- with(annotations[0]) {
- assertEquals("data", name)
- assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
- }
+ @Test fun annotatedClass() {
+ verifyPackageMember("test/data/classes/annotatedClass.kt", withKotlinRuntime = true) { cls ->
+ assertEquals(1, cls.annotations.count())
+ with(cls.annotations[0]) {
+ assertEquals("Strictfp", name)
+ assertEquals(Content.Empty, content)
+ assertEquals(DocumentationNode.Kind.Annotation, kind)
}
}
}
- Test fun annotatedClassWithAnnotationParameters() {
+ @Test fun dataClass() {
+ verifyPackageMember("test/data/classes/dataClass.kt") { cls ->
+ val modifiers = cls.details(DocumentationNode.Kind.Modifier).map { it.name }
+ assertTrue("data" in modifiers)
+ }
+ }
+
+ @Test fun sealedClass() {
+ verifyPackageMember("test/data/classes/sealedClass.kt") { cls ->
+ val modifiers = cls.details(DocumentationNode.Kind.Modifier).map { it.name }
+ assertEquals(1, modifiers.count { it == "sealed" })
+ }
+ }
+
+ @Test fun annotatedClassWithAnnotationParameters() {
verifyModel("test/data/classes/annotatedClassWithAnnotationParameters.kt") { model ->
with(model.members.single().members.single()) {
with(deprecation!!) {
- assertEquals("deprecated", name)
+ assertEquals("Deprecated", name)
assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Annotation, kind)
assertEquals(1, details.count())
@@ -188,15 +197,14 @@ public class ClassTest {
}
}
- Test fun javaAnnotationClass() {
- verifyModel("test/data/classes/javaAnnotationClass.kt") { model ->
+ @Test fun javaAnnotationClass() {
+ verifyModel("test/data/classes/javaAnnotationClass.kt", withJdk = true) { model ->
with(model.members.single().members.single()) {
assertEquals(1, annotations.count())
with(annotations[0]) {
assertEquals("Retention", name)
assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Annotation, kind)
- assertEquals(1, details.count())
with(details[0]) {
assertEquals(DocumentationNode.Kind.Parameter, kind)
assertEquals(1, details.count())
@@ -210,55 +218,55 @@ public class ClassTest {
}
}
- Test fun notOpenClass() {
+ @Test fun notOpenClass() {
verifyModel("test/data/classes/notOpenClass.kt") { model ->
with(model.members.single().members.first { it.name == "D"}.members.first { it.name == "f" }) {
val modifiers = details(DocumentationNode.Kind.Modifier)
- assertEquals(2, modifiers.size())
+ assertEquals(2, modifiers.size)
assertEquals("final", modifiers[1].name)
val overrideReferences = references(DocumentationReference.Kind.Override)
- assertEquals(1, overrideReferences.size())
+ assertEquals(1, overrideReferences.size)
}
}
}
- Test fun indirectOverride() {
+ @Test fun indirectOverride() {
verifyModel("test/data/classes/indirectOverride.kt") { model ->
with(model.members.single().members.first { it.name == "E"}.members.first { it.name == "foo" }) {
val modifiers = details(DocumentationNode.Kind.Modifier)
- assertEquals(2, modifiers.size())
+ assertEquals(2, modifiers.size)
assertEquals("final", modifiers[1].name)
val overrideReferences = references(DocumentationReference.Kind.Override)
- assertEquals(1, overrideReferences.size())
+ assertEquals(1, overrideReferences.size)
}
}
}
- Test fun innerClass() {
+ @Test fun innerClass() {
verifyPackageMember("test/data/classes/innerClass.kt") { cls ->
val innerClass = cls.members.single { it.name == "D" }
val modifiers = innerClass.details(DocumentationNode.Kind.Modifier)
- assertEquals(3, modifiers.size())
+ assertEquals(3, modifiers.size)
assertEquals("inner", modifiers[2].name)
}
}
- Test fun companionObjectExtension() {
+ @Test fun companionObjectExtension() {
verifyModel("test/data/classes/companionObjectExtension.kt") { model ->
val pkg = model.members.single()
val cls = pkg.members.single { it.name == "Foo" }
val extensions = cls.extensions.filter { it.kind == DocumentationNode.Kind.CompanionObjectProperty }
- assertEquals(1, extensions.size())
+ assertEquals(1, extensions.size)
}
}
- Test fun secondaryConstructor() {
+ @Test fun secondaryConstructor() {
verifyPackageMember("test/data/classes/secondaryConstructor.kt") { cls ->
val constructors = cls.members(DocumentationNode.Kind.Constructor)
- assertEquals(2, constructors.size())
- with (constructors.first { it.details(DocumentationNode.Kind.Parameter).size()== 1}) {
+ assertEquals(2, constructors.size)
+ with (constructors.first { it.details(DocumentationNode.Kind.Parameter).size == 1}) {
assertEquals("<init>", name)
assertEquals("This is a secondary constructor.", summary.toTestString())
}
diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt
index 98585b18..c4d867fb 100644
--- a/test/src/model/CommentTest.kt
+++ b/test/src/model/CommentTest.kt
@@ -5,7 +5,7 @@ import kotlin.test.*
import org.jetbrains.dokka.*
public class CommentTest {
- Test fun emptyDoc() {
+ @Test fun emptyDoc() {
verifyModel("test/data/comments/emptyDoc.kt") { model ->
with(model.members.single().members.single()) {
assertEquals(Content.Empty, content)
@@ -13,7 +13,7 @@ public class CommentTest {
}
}
- Test fun emptyDocButComment() {
+ @Test fun emptyDocButComment() {
verifyModel("test/data/comments/emptyDocButComment.kt") { model ->
with(model.members.single().members.single()) {
assertEquals(Content.Empty, content)
@@ -21,7 +21,7 @@ public class CommentTest {
}
}
- Test fun multilineDoc() {
+ @Test fun multilineDoc() {
verifyModel("test/data/comments/multilineDoc.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("doc1", content.summary.toTestString())
@@ -30,7 +30,7 @@ public class CommentTest {
}
}
- Test fun multilineDocWithComment() {
+ @Test fun multilineDocWithComment() {
verifyModel("test/data/comments/multilineDocWithComment.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("doc1", content.summary.toTestString())
@@ -39,7 +39,7 @@ public class CommentTest {
}
}
- Test fun oneLineDoc() {
+ @Test fun oneLineDoc() {
verifyModel("test/data/comments/oneLineDoc.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("doc", content.summary.toTestString())
@@ -47,7 +47,7 @@ public class CommentTest {
}
}
- Test fun oneLineDocWithComment() {
+ @Test fun oneLineDocWithComment() {
verifyModel("test/data/comments/oneLineDocWithComment.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("doc", content.summary.toTestString())
@@ -55,7 +55,7 @@ public class CommentTest {
}
}
- Test fun oneLineDocWithEmptyLine() {
+ @Test fun oneLineDocWithEmptyLine() {
verifyModel("test/data/comments/oneLineDocWithEmptyLine.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("doc", content.summary.toTestString())
@@ -63,7 +63,7 @@ public class CommentTest {
}
}
- Test fun emptySection() {
+ @Test fun emptySection() {
verifyModel("test/data/comments/emptySection.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Summary", content.summary.toTestString())
@@ -76,7 +76,7 @@ public class CommentTest {
}
}
- Test fun section1() {
+ @Test fun section1() {
verifyModel("test/data/comments/section1.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Summary", content.summary.toTestString())
@@ -89,7 +89,7 @@ public class CommentTest {
}
}
- Test fun section2() {
+ @Test fun section2() {
verifyModel("test/data/comments/section2.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Summary", content.summary.toTestString())
@@ -106,7 +106,7 @@ public class CommentTest {
}
}
- Test fun multilineSection() {
+ @Test fun multilineSection() {
verifyModel("test/data/comments/multilineSection.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Summary", content.summary.toTestString())
@@ -120,7 +120,7 @@ line two""", toTestString())
}
}
- Test fun directive() {
+ @Test fun directive() {
verifyModel("test/data/comments/directive.kt") { model ->
with(model.members.single().members.first()) {
assertEquals("Summary", content.summary.toTestString())
diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt
index e40777af..8d1cf609 100644
--- a/test/src/model/FunctionTest.kt
+++ b/test/src/model/FunctionTest.kt
@@ -1,11 +1,13 @@
package org.jetbrains.dokka.tests
+import org.jetbrains.dokka.Content
+import org.jetbrains.dokka.DocumentationNode
import org.junit.Test
-import kotlin.test.*
-import org.jetbrains.dokka.*
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
public class FunctionTest {
- Test fun function() {
+ @Test fun function() {
verifyModel("test/data/functions/function.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("fn", name)
@@ -18,18 +20,17 @@ public class FunctionTest {
}
}
- Test fun functionWithReceiver() {
+ @Test fun functionWithReceiver() {
verifyModel("test/data/functions/functionWithReceiver.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("String", name)
+ assertEquals("kotlin.String", name)
assertEquals(DocumentationNode.Kind.ExternalClass, kind)
assertEquals(2, members.count())
with(members[0]) {
assertEquals("fn", name)
assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("Function with receiver", content.summary.toTestString())
- assertEquals(4, details.count())
- assertEquals("internal", details.elementAt(0).name)
+ assertEquals("public", details.elementAt(0).name)
assertEquals("final", details.elementAt(1).name)
with(details.elementAt(2)) {
assertEquals("<this>", name)
@@ -51,14 +52,13 @@ public class FunctionTest {
}
}
- Test fun genericFunction() {
+ @Test fun genericFunction() {
verifyModel("test/data/functions/genericFunction.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("generic", name)
assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("generic function", content.summary.toTestString())
- assertEquals(4, details.count())
assertEquals("private", details.elementAt(0).name)
assertEquals("final", details.elementAt(1).name)
with(details.elementAt(2)) {
@@ -76,14 +76,13 @@ public class FunctionTest {
}
}
}
- Test fun genericFunctionWithConstraints() {
+ @Test fun genericFunctionWithConstraints() {
verifyModel("test/data/functions/genericFunctionWithConstraints.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("generic", name)
assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("generic function", content.summary.toTestString())
- assertEquals(5, details.count())
assertEquals("public", details.elementAt(0).name)
assertEquals("final", details.elementAt(1).name)
with(details.elementAt(2)) {
@@ -116,7 +115,7 @@ public class FunctionTest {
}
}
- Test fun functionWithParams() {
+ @Test fun functionWithParams() {
verifyModel("test/data/functions/functionWithParams.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("function", name)
@@ -125,8 +124,7 @@ public class FunctionTest {
assertEquals("""Function
Documentation""", content.description.toTestString())
- assertEquals(4, details.count())
- assertEquals("internal", details.elementAt(0).name)
+ assertEquals("public", details.elementAt(0).name)
assertEquals("final", details.elementAt(1).name)
with(details.elementAt(2)) {
assertEquals("x", name)
@@ -143,26 +141,37 @@ Documentation""", content.description.toTestString())
}
}
- Test fun annotatedFunction() {
- verifyModel("test/data/functions/annotatedFunction.kt") { model ->
- with(model.members.single().members.single()) {
- assertEquals(1, annotations.count())
- with(annotations[0]) {
- assertEquals("inline", name)
- assertEquals(Content.Empty, content)
- assertEquals(DocumentationNode.Kind.Annotation, kind)
- }
+ @Test fun annotatedFunction() {
+ verifyPackageMember("test/data/functions/annotatedFunction.kt", withKotlinRuntime = true) { func ->
+ assertEquals(1, func.annotations.count())
+ with(func.annotations[0]) {
+ assertEquals("Strictfp", name)
+ assertEquals(Content.Empty, content)
+ assertEquals(DocumentationNode.Kind.Annotation, kind)
}
}
}
- Test fun functionWithAnnotatedParam() {
+ @Test fun functionWithNotDocumentedAnnotation() {
+ verifyPackageMember("test/data/functions/functionWithNotDocumentedAnnotation.kt") { func ->
+ assertEquals(0, func.annotations.count())
+ }
+ }
+
+ @Test fun inlineFunction() {
+ verifyPackageMember("test/data/functions/inlineFunction.kt") { func ->
+ val modifiers = func.details(DocumentationNode.Kind.Modifier).map { it.name }
+ assertTrue("inline" in modifiers)
+ }
+ }
+
+ @Test fun functionWithAnnotatedParam() {
verifyModel("test/data/functions/functionWithAnnotatedParam.kt") { model ->
- with(model.members.single().members.single()) {
+ with(model.members.single().members.single { it.name == "function"} ) {
with(details.elementAt(2)) {
assertEquals(1, annotations.count())
with(annotations[0]) {
- assertEquals("noinline", name)
+ assertEquals("Fancy", name)
assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Annotation, kind)
}
@@ -171,12 +180,21 @@ Documentation""", content.description.toTestString())
}
}
- Test fun annotatedFunctionWithAnnotationParameters() {
+ @Test fun functionWithNoinlineParam() {
+ verifyPackageMember("test/data/functions/functionWithNoinlineParam.kt") { func ->
+ with(func.details.elementAt(2)) {
+ val modifiers = details(DocumentationNode.Kind.Modifier).map { it.name }
+ assertTrue("noinline" in modifiers)
+ }
+ }
+ }
+
+ @Test fun annotatedFunctionWithAnnotationParameters() {
verifyModel("test/data/functions/annotatedFunctionWithAnnotationParameters.kt") { model ->
- with(model.members.single().members.single()) {
+ with(model.members.single().members.single { it.name == "f"}) {
assertEquals(1, annotations.count())
with(annotations[0]) {
- assertEquals("inlineOptions", name)
+ assertEquals("Fancy", name)
assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Annotation, kind)
assertEquals(1, details.count())
@@ -185,7 +203,7 @@ Documentation""", content.description.toTestString())
assertEquals(1, details.count())
with(details[0]) {
assertEquals(DocumentationNode.Kind.Value, kind)
- assertEquals("[InlineOption.LOCAL_CONTINUE_AND_BREAK]", name)
+ assertEquals("1", name)
}
}
}
@@ -193,7 +211,7 @@ Documentation""", content.description.toTestString())
}
}
- Test fun functionWithDefaultParameter() {
+ @Test fun functionWithDefaultParameter() {
verifyModel("test/data/functions/functionWithDefaultParameter.kt") { model ->
with(model.members.single().members.single()) {
with(details.elementAt(2)) {
diff --git a/test/src/model/JavaTest.kt b/test/src/model/JavaTest.kt
index 3129bcc0..5ec29b25 100644
--- a/test/src/model/JavaTest.kt
+++ b/test/src/model/JavaTest.kt
@@ -1,11 +1,14 @@
package org.jetbrains.dokka.tests
-import kotlin.test.*
-import org.jetbrains.dokka.*
-import org.junit.*
+import org.jetbrains.dokka.DocumentationNode
+import org.jetbrains.dokka.DocumentationReference
+import org.junit.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
public class JavaTest {
- Test fun function() {
+ @Test fun function() {
verifyPackageMember("test/data/java/member.java") { cls ->
assertEquals("Test", cls.name)
assertEquals(DocumentationNode.Kind.Class, cls.kind)
@@ -13,7 +16,7 @@ public class JavaTest {
assertEquals("fn", name)
assertEquals(DocumentationNode.Kind.Function, kind)
assertEquals("Summary for Function", content.summary.toTestString().trimEnd())
- assertEquals(3, content.sections.size())
+ assertEquals(3, content.sections.size)
with(content.sections[0]) {
assertEquals("Parameters", tag)
assertEquals("name", subjectName)
@@ -43,7 +46,7 @@ public class JavaTest {
}
}
- Test fun memberWithModifiers() {
+ @Test fun memberWithModifiers() {
verifyPackageMember("test/data/java/memberWithModifiers.java") { cls ->
assertEquals("abstract", cls.details[0].name)
with(cls.members.single { it.name == "fn" }) {
@@ -55,16 +58,16 @@ public class JavaTest {
}
}
- Test fun superClass() {
+ @Test fun superClass() {
verifyPackageMember("test/data/java/superClass.java") { cls ->
val superTypes = cls.details(DocumentationNode.Kind.Supertype)
- assertEquals(2, superTypes.size())
+ assertEquals(2, superTypes.size)
assertEquals("Exception", superTypes[0].name)
assertEquals("Cloneable", superTypes[1].name)
}
}
- Test fun arrayType() {
+ @Test fun arrayType() {
verifyPackageMember("test/data/java/arrayType.java") { cls ->
with(cls.members.single()) {
val type = detail(DocumentationNode.Kind.Type)
@@ -79,7 +82,7 @@ public class JavaTest {
}
}
- Test fun typeParameter() {
+ @Test fun typeParameter() {
verifyPackageMember("test/data/java/typeParameter.java") { cls ->
val typeParameters = cls.details(DocumentationNode.Kind.TypeParameter)
with(typeParameters.single()) {
@@ -98,24 +101,24 @@ public class JavaTest {
}
}
- Test fun constructors() {
+ @Test fun constructors() {
verifyPackageMember("test/data/java/constructors.java") { cls ->
val constructors = cls.members(DocumentationNode.Kind.Constructor)
- assertEquals(2, constructors.size())
+ assertEquals(2, constructors.size)
with(constructors[0]) {
assertEquals("<init>", name)
}
}
}
- Test fun innerClass() {
+ @Test fun innerClass() {
verifyPackageMember("test/data/java/innerClass.java") { cls ->
val innerClass = cls.members(DocumentationNode.Kind.Class).single()
assertEquals("D", innerClass.name)
}
}
- Test fun varargs() {
+ @Test fun varargs() {
verifyPackageMember("test/data/java/varargs.java") { cls ->
val fn = cls.members(DocumentationNode.Kind.Function).single()
val param = fn.detail(DocumentationNode.Kind.Parameter)
@@ -126,7 +129,7 @@ public class JavaTest {
}
}
- Test fun fields() {
+ @Test fun fields() {
verifyPackageMember("test/data/java/field.java") { cls ->
val i = cls.members(DocumentationNode.Kind.Property).single { it.name == "i" }
assertEquals("Int", i.detail(DocumentationNode.Kind.Type).name)
@@ -137,16 +140,16 @@ public class JavaTest {
}
}
- Test fun staticMethod() {
+ @Test fun staticMethod() {
verifyPackageMember("test/data/java/staticMethod.java") { cls ->
val m = cls.members(DocumentationNode.Kind.CompanionObjectFunction).single { it.name == "foo" }
assertFalse("static" in m.details(DocumentationNode.Kind.Modifier).map { it.name })
}
}
- Test fun annotatedAnnotation() {
+ @Test fun annotatedAnnotation() {
verifyPackageMember("test/data/java/annotatedAnnotation.java") { cls ->
- assertEquals(2, cls.annotations.size())
+ assertEquals(2, cls.annotations.size)
with(cls.annotations[0]) {
assertEquals(1, details.count())
with(details[0]) {
@@ -161,8 +164,8 @@ public class JavaTest {
}
}
- Test fun deprecation() {
- verifyPackageMember("test/data/java/deprecation.java") { cls ->
+ @Test fun deprecation() {
+ verifyPackageMember("test/data/java/deprecation.java", withJdk = true) { cls ->
val fn = cls.members(DocumentationNode.Kind.Function).single()
with(fn.deprecation!!) {
assertEquals(1, details.count())
@@ -178,26 +181,26 @@ public class JavaTest {
}
}
- Test fun javaLangObject() {
- verifyPackageMember("test/data/java/javaLangObject.java") { cls ->
+ @Test fun javaLangObject() {
+ verifyPackageMember("test/data/java/javaLangObject.java", withJdk = true) { cls ->
val fn = cls.members(DocumentationNode.Kind.Function).single()
assertEquals("Any", fn.detail(DocumentationNode.Kind.Type).name)
}
}
- Test fun enumValues() {
- verifyPackageMember("test/data/java/enumValues.java") { cls ->
+ @Test fun enumValues() {
+ verifyPackageMember("test/data/java/enumValues.java", withJdk = true) { cls ->
val superTypes = cls.details(DocumentationNode.Kind.Supertype)
- assertEquals(0, superTypes.size())
- assertEquals(1, cls.members(DocumentationNode.Kind.EnumItem).size())
+ assertEquals(0, superTypes.size)
+ assertEquals(1, cls.members(DocumentationNode.Kind.EnumItem).size)
}
}
- Test fun inheritorLinks() {
+ @Test fun inheritorLinks() {
verifyPackageMember("test/data/java/inheritorLinks.java") { cls ->
val fooClass = cls.members.single { it.name == "Foo" }
val inheritors = fooClass.references(DocumentationReference.Kind.Inheritor)
- assertEquals(1, inheritors.size())
+ assertEquals(1, inheritors.size)
}
}
}
diff --git a/test/src/model/LinkTest.kt b/test/src/model/LinkTest.kt
index 151d2696..a8004367 100644
--- a/test/src/model/LinkTest.kt
+++ b/test/src/model/LinkTest.kt
@@ -5,7 +5,7 @@ import kotlin.test.*
import org.jetbrains.dokka.*
public class LinkTest {
- Test fun linkToSelf() {
+ @Test fun linkToSelf() {
verifyModel("test/data/links/linkToSelf.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Foo", name)
@@ -15,7 +15,7 @@ public class LinkTest {
}
}
- Test fun linkToMember() {
+ @Test fun linkToMember() {
verifyModel("test/data/links/linkToMember.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Foo", name)
@@ -25,7 +25,7 @@ public class LinkTest {
}
}
- Test fun linkToQualifiedMember() {
+ @Test fun linkToQualifiedMember() {
verifyModel("test/data/links/linkToQualifiedMember.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Foo", name)
@@ -35,7 +35,7 @@ public class LinkTest {
}
}
- Test fun linkToParam() {
+ @Test fun linkToParam() {
verifyModel("test/data/links/linkToParam.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("Foo", name)
diff --git a/test/src/model/PackageTest.kt b/test/src/model/PackageTest.kt
index 701efbf0..52324f1d 100644
--- a/test/src/model/PackageTest.kt
+++ b/test/src/model/PackageTest.kt
@@ -8,7 +8,7 @@ import kotlin.test.assertEquals
import kotlin.test.assertTrue
public class PackageTest {
- Test fun rootPackage() {
+ @Test fun rootPackage() {
verifyModel("test/data/packages/rootPackage.kt") { model ->
with(model.members.single()) {
assertEquals(DocumentationNode.Kind.Package, kind)
@@ -21,7 +21,7 @@ public class PackageTest {
}
}
- Test fun simpleNamePackage() {
+ @Test fun simpleNamePackage() {
verifyModel("test/data/packages/simpleNamePackage.kt") { model ->
with(model.members.single()) {
assertEquals(DocumentationNode.Kind.Package, kind)
@@ -34,7 +34,7 @@ public class PackageTest {
}
}
- Test fun dottedNamePackage() {
+ @Test fun dottedNamePackage() {
verifyModel("test/data/packages/dottedNamePackage.kt") { model ->
with(model.members.single()) {
assertEquals(DocumentationNode.Kind.Package, kind)
@@ -47,7 +47,7 @@ public class PackageTest {
}
}
- Test fun multipleFiles() {
+ @Test fun multipleFiles() {
verifyModel(KotlinSourceRoot("test/data/packages/dottedNamePackage.kt"),
KotlinSourceRoot("test/data/packages/simpleNamePackage.kt")) { model ->
assertEquals(2, model.members.count())
@@ -69,7 +69,7 @@ public class PackageTest {
}
}
- Test fun multipleFilesSamePackage() {
+ @Test fun multipleFilesSamePackage() {
verifyModel(KotlinSourceRoot("test/data/packages/simpleNamePackage.kt"),
KotlinSourceRoot("test/data/packages/simpleNamePackage2.kt")) { model ->
assertEquals(1, model.members.count())
diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt
index 93a0f681..093772b4 100644
--- a/test/src/model/PropertyTest.kt
+++ b/test/src/model/PropertyTest.kt
@@ -1,11 +1,14 @@
package org.jetbrains.dokka.tests
+import org.jetbrains.dokka.Content
+import org.jetbrains.dokka.DocumentationNode
+import org.jetbrains.dokka.DocumentationReference
import org.junit.Test
-import kotlin.test.*
-import org.jetbrains.dokka.*
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
public class PropertyTest {
- Test fun valueProperty() {
+ @Test fun valueProperty() {
verifyModel("test/data/properties/valueProperty.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
@@ -18,7 +21,7 @@ public class PropertyTest {
}
}
- Test fun variableProperty() {
+ @Test fun variableProperty() {
verifyModel("test/data/properties/variableProperty.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
@@ -31,7 +34,7 @@ public class PropertyTest {
}
}
- Test fun valuePropertyWithGetter() {
+ @Test fun valuePropertyWithGetter() {
verifyModel("test/data/properties/valuePropertyWithGetter.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
@@ -44,17 +47,16 @@ public class PropertyTest {
}
}
- Test fun variablePropertyWithAccessors() {
+ @Test fun variablePropertyWithAccessors() {
verifyModel("test/data/properties/variablePropertyWithAccessors.kt") { model ->
with(model.members.single().members.single()) {
assertEquals("property", name)
assertEquals(DocumentationNode.Kind.Property, kind)
assertEquals(Content.Empty, content)
- assertEquals(4, details.count())
assertEquals("String", detail(DocumentationNode.Kind.Type).name)
val modifiers = details(DocumentationNode.Kind.Modifier).map { it.name }
assertTrue("final" in modifiers)
- assertTrue("internal" in modifiers)
+ assertTrue("public" in modifiers)
assertTrue("var" in modifiers)
assertTrue(links.none())
assertTrue(members.none())
@@ -62,12 +64,12 @@ public class PropertyTest {
}
}
- Test fun annotatedProperty() {
- verifyModel("test/data/properties/annotatedProperty.kt") { model ->
+ @Test fun annotatedProperty() {
+ verifyModel("test/data/properties/annotatedProperty.kt", withKotlinRuntime = true) { model ->
with(model.members.single().members.single()) {
assertEquals(1, annotations.count())
with(annotations[0]) {
- assertEquals("inline", name)
+ assertEquals("Volatile", name)
assertEquals(Content.Empty, content)
assertEquals(DocumentationNode.Kind.Annotation, kind)
}
@@ -75,10 +77,10 @@ public class PropertyTest {
}
}
- Test fun propertyWithReceiver() {
+ @Test fun propertyWithReceiver() {
verifyModel("test/data/properties/propertyWithReceiver.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("String", name)
+ assertEquals("kotlin.String", name)
assertEquals(DocumentationNode.Kind.ExternalClass, kind)
with(members.single()) {
assertEquals("foobar", name)
@@ -88,7 +90,7 @@ public class PropertyTest {
}
}
- Test fun propertyOverride() {
+ @Test fun propertyOverride() {
verifyModel("test/data/properties/propertyOverride.kt") { model ->
with(model.members.single().members.single { it.name == "Bar" }.members.single { it.name == "xyzzy"}) {
assertEquals("xyzzy", name)