From d1937ab65bef189a48a55218a4194c0afb778053 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Tue, 7 May 2019 14:30:25 +0200 Subject: Fix some tests --- .../main/kotlin/Formats/MarkdownFormatService.kt | 24 ++++++----- .../main/kotlin/Formats/StructuredFormatService.kt | 13 +++--- core/testdata/format/JavaSupertype.html | 6 +-- core/testdata/format/classWithCompanionObject.html | 9 ++--- core/testdata/format/codeBlock.html | 6 +-- .../crossLanguage/kotlinExtendsJava/Bar.html | 6 +-- core/testdata/format/deprecated.class.html | 3 +- core/testdata/format/deprecated.package.html | 9 ++--- core/testdata/format/entity.html | 3 +- .../format/functionalTypeWithNamedParameters.html | 9 ++--- core/testdata/format/javaLinkTag.html | 6 +-- core/testdata/format/javaLinkTagWithLabel.html | 6 +-- core/testdata/format/javaSeeTag.html | 6 +-- core/testdata/format/linkWithLabel.html | 6 +-- core/testdata/format/linkWithStarProjection.html | 3 +- .../multiplatform.md | 5 +-- core/testdata/format/multiplatform/implied/foo.md | 16 ++++---- .../multiplatform/merge/multiplatform.package.md | 2 +- .../format/multiplatform/mergeMembers/foo.md | 18 ++++----- .../format/multiplatform/omitRedundant/foo.md | 10 ++--- .../multiplatform.index.md | 2 +- .../multiplatform.package.md | 4 +- .../multiplatform.index.md | 2 +- .../multiplatform.package.md | 4 +- .../multiplatform/simple/multiplatform.package.md | 4 +- core/testdata/format/orderedList.html | 3 +- core/testdata/format/overloads.html | 3 +- core/testdata/format/reifiedTypeParameter.kt | 2 +- core/testdata/format/reifiedTypeParameter.md | 2 +- core/testdata/format/sinceKotlin.html | 3 +- core/testdata/format/typeAliases.package.md | 3 -- core/testdata/format/typeLink.html | 3 +- .../testData/typeSafeConfiguration/build.gradle | 46 +++++++++++----------- 33 files changed, 102 insertions(+), 145 deletions(-) diff --git a/core/src/main/kotlin/Formats/MarkdownFormatService.kt b/core/src/main/kotlin/Formats/MarkdownFormatService.kt index 4265394f..71356619 100644 --- a/core/src/main/kotlin/Formats/MarkdownFormatService.kt +++ b/core/src/main/kotlin/Formats/MarkdownFormatService.kt @@ -159,16 +159,20 @@ open class MarkdownOutputBuilder(to: StringBuilder, } override fun appendParagraph(body: () -> Unit) { - if (inTableCell) { - ensureNewline() - body() - } else if (listStack.isNotEmpty()) { - body() - ensureNewline() - } else { - ensureParagraph() - body() - ensureParagraph() + when { + inTableCell -> { + ensureNewline() + body() + } + listStack.isNotEmpty() -> { + body() + ensureNewline() + } + else -> { + ensureParagraph() + body() + ensureParagraph() + } } } diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 44b06e8b..a6c1b57f 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -111,7 +111,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, open fun appendSinceKotlin(version: String) { appendParagraph { - appendText("Available since Kotlin: ") + appendText("Since: ") appendCode { appendText(version) } } } @@ -280,15 +280,13 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, protected open fun appendPlatformsAsText(platforms: PlatformsData) { if (platforms.isNotEmpty()) { - appendLine() - appendText(platforms.keys.joinToString(prefix = "(", postfix = ")")) + appendText(platforms.keys.joinToString(prefix = "(", postfix = ") ")) } } protected open fun appendPlatforms(platforms: PlatformsData) { if (platforms.isNotEmpty()) { - appendLine() - appendText(platforms.keys.joinToString(prefix = "(", postfix = ")")) + appendText(platforms.keys.joinToString(prefix = "(", postfix = ") ")) } } @@ -775,9 +773,10 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, appendPlatforms(platforms) } // appendHeader(level = 4) { - appendParagraph { +// appendParagraph { appendLink(memberLocation) - } + +// } // if (members.singleOrNull()?.kind != NodeKind.ExternalClass) { // appendPlatforms(platforms) // } diff --git a/core/testdata/format/JavaSupertype.html b/core/testdata/format/JavaSupertype.html index ddc0abcc..93346a4a 100644 --- a/core/testdata/format/JavaSupertype.html +++ b/core/testdata/format/JavaSupertype.html @@ -13,8 +13,7 @@ -

<init>

- +<init> Bar() @@ -25,8 +24,7 @@ -

returnFoo

- +returnFoo open fun returnFoo(foo: JavaSupertype.Foo!): JavaSupertype.Foo! diff --git a/core/testdata/format/classWithCompanionObject.html b/core/testdata/format/classWithCompanionObject.html index 4525711d..95fcbf6b 100644 --- a/core/testdata/format/classWithCompanionObject.html +++ b/core/testdata/format/classWithCompanionObject.html @@ -13,8 +13,7 @@ -

<init>

- +<init> Klass() @@ -25,8 +24,7 @@ -

x

- +x val x: Int @@ -37,8 +35,7 @@ -

foo

- +foo fun foo(): Unit diff --git a/core/testdata/format/codeBlock.html b/core/testdata/format/codeBlock.html index 9bf0dcd9..a877e8c6 100644 --- a/core/testdata/format/codeBlock.html +++ b/core/testdata/format/codeBlock.html @@ -19,8 +19,7 @@ fun readFile(name: String): String {...} -

<init>

- +<init> Throws()

This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.

@@ -49,8 +48,7 @@ fun readFile(name: String): String {...} -

<init>

- +<init> ItDoesSomeObfuscatedThing()

Check output of

diff --git a/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html b/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html index 8842969e..c413595b 100644 --- a/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html +++ b/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html @@ -14,8 +14,7 @@ -

<init>

- +<init> Bar()

See xyzzy

@@ -28,8 +27,7 @@ -

xyzzy

- +xyzzy open fun xyzzy(): Unit diff --git a/core/testdata/format/deprecated.class.html b/core/testdata/format/deprecated.class.html index bfe138f4..d0e27e88 100644 --- a/core/testdata/format/deprecated.class.html +++ b/core/testdata/format/deprecated.class.html @@ -16,8 +16,7 @@ -

<init>

- +<init> C() diff --git a/core/testdata/format/deprecated.package.html b/core/testdata/format/deprecated.package.html index c63da8c6..a02783b6 100644 --- a/core/testdata/format/deprecated.package.html +++ b/core/testdata/format/deprecated.package.html @@ -12,8 +12,7 @@ -

C

- +C class C @@ -24,8 +23,7 @@ -

p

- +p val p: Int @@ -36,8 +34,7 @@ -

f

- +f fun f(): Unit diff --git a/core/testdata/format/entity.html b/core/testdata/format/entity.html index 41f21cb1..2068009e 100644 --- a/core/testdata/format/entity.html +++ b/core/testdata/format/entity.html @@ -14,8 +14,7 @@ -

<init>

- +<init> Bar()

Copyright © JetBrains 2015 "

diff --git a/core/testdata/format/functionalTypeWithNamedParameters.html b/core/testdata/format/functionalTypeWithNamedParameters.html index 4d959605..c0b0306b 100644 --- a/core/testdata/format/functionalTypeWithNamedParameters.html +++ b/core/testdata/format/functionalTypeWithNamedParameters.html @@ -14,8 +14,7 @@ -

<init>

- +<init> A() @@ -39,8 +38,7 @@ -

<init>

- +<init> B() @@ -64,8 +62,7 @@ -

<init>

- +<init> C() diff --git a/core/testdata/format/javaLinkTag.html b/core/testdata/format/javaLinkTag.html index 92d69a6b..0a027c0e 100644 --- a/core/testdata/format/javaLinkTag.html +++ b/core/testdata/format/javaLinkTag.html @@ -14,8 +14,7 @@ -

<init>

- +<init> Foo()

Call #bar() to do the job.

@@ -28,8 +27,7 @@ -

bar

- +bar open fun bar(): Unit diff --git a/core/testdata/format/javaLinkTagWithLabel.html b/core/testdata/format/javaLinkTagWithLabel.html index a729038a..f592f85e 100644 --- a/core/testdata/format/javaLinkTagWithLabel.html +++ b/core/testdata/format/javaLinkTagWithLabel.html @@ -14,8 +14,7 @@ -

<init>

- +<init> Foo()

Call this wonderful method to do the job.

@@ -28,8 +27,7 @@ -

bar

- +bar open fun bar(): Unit diff --git a/core/testdata/format/javaSeeTag.html b/core/testdata/format/javaSeeTag.html index 25c7fbbb..0f5465aa 100644 --- a/core/testdata/format/javaSeeTag.html +++ b/core/testdata/format/javaSeeTag.html @@ -15,8 +15,7 @@ -

<init>

- +<init> Foo() @@ -27,8 +26,7 @@ -

bar

- +bar open fun bar(): Unit diff --git a/core/testdata/format/linkWithLabel.html b/core/testdata/format/linkWithLabel.html index 6293043a..daed792c 100644 --- a/core/testdata/format/linkWithLabel.html +++ b/core/testdata/format/linkWithLabel.html @@ -14,8 +14,7 @@ -

<init>

- +<init> Bar()

Use this method for best results.

@@ -28,8 +27,7 @@ -

foo

- +foo fun foo(): Unit diff --git a/core/testdata/format/linkWithStarProjection.html b/core/testdata/format/linkWithStarProjection.html index f6d5eaf2..a9d6b125 100644 --- a/core/testdata/format/linkWithStarProjection.html +++ b/core/testdata/format/linkWithStarProjection.html @@ -13,8 +13,7 @@ -

foo

- +foo fun foo(c: Enum<*>): Unit diff --git a/core/testdata/format/multiplatform/breadcrumbsInMemberOfMemberOfGroupNode/multiplatform.md b/core/testdata/format/multiplatform/breadcrumbsInMemberOfMemberOfGroupNode/multiplatform.md index 3c8ec66d..06b8ead6 100644 --- a/core/testdata/format/multiplatform/breadcrumbsInMemberOfMemberOfGroupNode/multiplatform.md +++ b/core/testdata/format/multiplatform/breadcrumbsInMemberOfMemberOfGroupNode/multiplatform.md @@ -2,7 +2,4 @@ # magic -`fun magic(): Unit` - -**Platform and version requirements:** JS - +(JS) `fun magic(): Unit` \ No newline at end of file diff --git a/core/testdata/format/multiplatform/implied/foo.md b/core/testdata/format/multiplatform/implied/foo.md index fca2aff4..1329ea7a 100644 --- a/core/testdata/format/multiplatform/implied/foo.md +++ b/core/testdata/format/multiplatform/implied/foo.md @@ -2,23 +2,23 @@ # Foo -`class Foo` +(JVM, JS) `class Foo` This is a foo. ### Constructors -| [<init>](-init-.md) | `Foo()`
This is a foo. | +| (JVM, JS) [<init>](-init-.md) | `Foo()`
This is a foo. | ### Properties -| [propJs](prop-js.md)
(JS) | `val propJs: String` | -| [propJvm](prop-jvm.md)
(JVM) | `val propJvm: String` | -| [propJvmAndJs](prop-jvm-and-js.md) | `val propJvmAndJs: Int` | +| (JS) [propJs](prop-js.md) | `val propJs: String` | +| (JVM) [propJvm](prop-jvm.md) | `val propJvm: String` | +| (JVM, JS) [propJvmAndJs](prop-jvm-and-js.md) | `val propJvmAndJs: Int` | ### Functions -| [bothJvmAndJs](both-jvm-and-js.md) | `fun bothJvmAndJs(): Unit` | -| [js](js.md)
(JS) | `fun js(): Unit` | -| [jvm](jvm.md)
(JVM) | `fun jvm(): Unit` | +| (JVM, JS) [bothJvmAndJs](both-jvm-and-js.md) | `fun bothJvmAndJs(): Unit` | +| (JS) [js](js.md) | `fun js(): Unit` | +| (JVM) [jvm](jvm.md) | `fun jvm(): Unit` | diff --git a/core/testdata/format/multiplatform/merge/multiplatform.package.md b/core/testdata/format/multiplatform/merge/multiplatform.package.md index 2232c753..2dfdce38 100644 --- a/core/testdata/format/multiplatform/merge/multiplatform.package.md +++ b/core/testdata/format/multiplatform/merge/multiplatform.package.md @@ -4,5 +4,5 @@ ### Types -| [Foo](-foo/index.md)
(JVM, JS) | `class Foo`
This is a foo. | +| (JVM, JS) [Foo](-foo/index.md) | `class Foo`
This is a foo. | diff --git a/core/testdata/format/multiplatform/mergeMembers/foo.md b/core/testdata/format/multiplatform/mergeMembers/foo.md index 7f41b7d1..1329ea7a 100644 --- a/core/testdata/format/multiplatform/mergeMembers/foo.md +++ b/core/testdata/format/multiplatform/mergeMembers/foo.md @@ -2,25 +2,23 @@ # Foo -`class Foo` - -**Platform and version requirements:** JVM, JS +(JVM, JS) `class Foo` This is a foo. ### Constructors -| [<init>](-init-.md) | `Foo()`
This is a foo. | +| (JVM, JS) [<init>](-init-.md) | `Foo()`
This is a foo. | ### Properties -| [propJs](prop-js.md)
(JS) | `val propJs: String` | -| [propJvm](prop-jvm.md)
(JVM) | `val propJvm: String` | -| [propJvmAndJs](prop-jvm-and-js.md) | `val propJvmAndJs: Int` | +| (JS) [propJs](prop-js.md) | `val propJs: String` | +| (JVM) [propJvm](prop-jvm.md) | `val propJvm: String` | +| (JVM, JS) [propJvmAndJs](prop-jvm-and-js.md) | `val propJvmAndJs: Int` | ### Functions -| [bothJvmAndJs](both-jvm-and-js.md) | `fun bothJvmAndJs(): Unit` | -| [js](js.md)
(JS) | `fun js(): Unit` | -| [jvm](jvm.md)
(JVM) | `fun jvm(): Unit` | +| (JVM, JS) [bothJvmAndJs](both-jvm-and-js.md) | `fun bothJvmAndJs(): Unit` | +| (JS) [js](js.md) | `fun js(): Unit` | +| (JVM) [jvm](jvm.md) | `fun jvm(): Unit` | diff --git a/core/testdata/format/multiplatform/omitRedundant/foo.md b/core/testdata/format/multiplatform/omitRedundant/foo.md index a20b14cf..49a46972 100644 --- a/core/testdata/format/multiplatform/omitRedundant/foo.md +++ b/core/testdata/format/multiplatform/omitRedundant/foo.md @@ -2,21 +2,19 @@ # Foo -`class Foo` - -**Platform and version requirements:** JVM +(JVM) `class Foo` This is a foo. ### Constructors -| [<init>](-init-.md) | `Foo()`
This is a foo. | +| (JVM) [<init>](-init-.md) | `Foo()`
This is a foo. | ### Properties -| [propJvm](prop-jvm.md) | `val propJvm: String` | +| (JVM) [propJvm](prop-jvm.md) | `val propJvm: String` | ### Functions -| [jvm](jvm.md) | `fun jvm(): Unit` | +| (JVM) [jvm](jvm.md) | `fun jvm(): Unit` | diff --git a/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.index.md b/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.index.md index 51dc430b..9b0d6b63 100644 --- a/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.index.md +++ b/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.index.md @@ -2,7 +2,7 @@ ### Packages -| [foo.bar](foo.bar/index.md)
(JVM, JS) | | +| (JVM, JS) [foo.bar](foo.bar/index.md) | | ### Index diff --git a/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.package.md b/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.package.md index 4ddfe2e3..a7fef864 100644 --- a/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.package.md +++ b/core/testdata/format/multiplatform/packagePlatformsFromMembers/multiplatform.package.md @@ -2,9 +2,7 @@ ## Package foo.bar -**Platform and version requirements:** JVM, JS - ### Functions -| [buz](buz.md)
(JVM, JS) | `fun buz(): Unit` | +| (JVM, JS) [buz](buz.md) | `fun buz(): Unit` | diff --git a/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.index.md b/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.index.md index 887441c1..b5543c80 100644 --- a/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.index.md +++ b/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.index.md @@ -2,7 +2,7 @@ ### Packages -| [some](some/index.md)
(JVM) | | +| (JVM) [some](some/index.md) | | ### Index diff --git a/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.package.md b/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.package.md index ff480b5a..6e42d0dc 100644 --- a/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.package.md +++ b/core/testdata/format/multiplatform/packagePlatformsWithExtExtensions/multiplatform.package.md @@ -2,9 +2,7 @@ ## Package some -**Platform and version requirements:** JVM - ### Extensions for External Classes -| [kotlin.String](kotlin.-string/index.md) | | +| (JVM) [kotlin.String](kotlin.-string/index.md) | | diff --git a/core/testdata/format/multiplatform/simple/multiplatform.package.md b/core/testdata/format/multiplatform/simple/multiplatform.package.md index fad7e90d..b5d9cc7d 100644 --- a/core/testdata/format/multiplatform/simple/multiplatform.package.md +++ b/core/testdata/format/multiplatform/simple/multiplatform.package.md @@ -4,6 +4,6 @@ ### Types -| [Bar](-bar/index.md)
(JS) | `class Bar`
This is a bar. | -| [Foo](-foo/index.md)
(JVM) | `class Foo`
This is a foo. | +| (JS) [Bar](-bar/index.md) | `class Bar`
This is a bar. | +| (JVM) [Foo](-foo/index.md) | `class Foo`
This is a foo. | diff --git a/core/testdata/format/orderedList.html b/core/testdata/format/orderedList.html index 0e1b82ef..b011b5b3 100644 --- a/core/testdata/format/orderedList.html +++ b/core/testdata/format/orderedList.html @@ -17,8 +17,7 @@ -

<init>

- +<init> Bar()

Usage instructions:

diff --git a/core/testdata/format/overloads.html b/core/testdata/format/overloads.html index 377f079f..1545cb9f 100644 --- a/core/testdata/format/overloads.html +++ b/core/testdata/format/overloads.html @@ -12,8 +12,7 @@ -

f

- +f fun f(x: Int): Unit
fun f(x: String): Unit diff --git a/core/testdata/format/reifiedTypeParameter.kt b/core/testdata/format/reifiedTypeParameter.kt index 00fa1dc9..1b1de359 100644 --- a/core/testdata/format/reifiedTypeParameter.kt +++ b/core/testdata/format/reifiedTypeParameter.kt @@ -1,3 +1,3 @@ -inline fun f() { +inline fun f(a: () -> String) { } diff --git a/core/testdata/format/reifiedTypeParameter.md b/core/testdata/format/reifiedTypeParameter.md index 5bd3e738..7bb406ee 100644 --- a/core/testdata/format/reifiedTypeParameter.md +++ b/core/testdata/format/reifiedTypeParameter.md @@ -2,4 +2,4 @@ # f -`inline fun f(): Unit` \ No newline at end of file +`inline fun f(a: () -> String): Unit` \ No newline at end of file diff --git a/core/testdata/format/sinceKotlin.html b/core/testdata/format/sinceKotlin.html index 0d493f52..12cdd87f 100644 --- a/core/testdata/format/sinceKotlin.html +++ b/core/testdata/format/sinceKotlin.html @@ -14,8 +14,7 @@ -

<init>

- +<init> Since1.1()

Useful

diff --git a/core/testdata/format/typeAliases.package.md b/core/testdata/format/typeAliases.package.md index bb0c717a..d5ed2247 100644 --- a/core/testdata/format/typeAliases.package.md +++ b/core/testdata/format/typeAliases.package.md @@ -7,9 +7,6 @@ | [A](-a/index.md) | `class A` | | [B](-b/index.md) | `class B` | | [C](-c/index.md) | `class C` | - -### Type Aliases - | [D](-d.md) | `typealias D = `[`A`](-a/index.md) | | [E](-e.md) | `typealias E = `[`D`](-d.md) | | [F](-f.md) | `typealias F = (`[`A`](-a/index.md)`) -> `[`B`](-b/index.md) | diff --git a/core/testdata/format/typeLink.html b/core/testdata/format/typeLink.html index 646f97fa..f25efe3c 100644 --- a/core/testdata/format/typeLink.html +++ b/core/testdata/format/typeLink.html @@ -13,8 +13,7 @@ -

<init>

- +<init> Bar() diff --git a/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle b/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle index 327cead8..33e8c9c4 100644 --- a/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle +++ b/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle @@ -26,47 +26,45 @@ def configureDokkaTypeSafely(DokkaTask dokka) { moduleName = "some String" outputFormat = "some String" outputDirectory = "some String" + dokkaFatJar = file("some File") + cacheRoot = null as String + impliedPlatforms = new ArrayList() + + kotlinTasks(new Callable>() { + @Override + List call() { + return defaultKotlinTasks() + } + }) + } + dokka.extensions.findByName("configuration").with { + classpath = Collections.singleton(file("someClassDir")) includes = Collections.emptyList() - linkMappings = new ArrayList() samples = Collections.emptyList() jdkVersion = 6 - sourceDirs = Collections.emptyList() - sourceRoots = new ArrayList() - dokkaFatJar = file("some File") + sourceDirs = Collections. emptyList() + sourceRoots = new ArrayList() + includeNonPublic = false skipDeprecated = false skipEmptyPackages = true reportUndocumented = true - perPackageOptions = new ArrayList() - impliedPlatforms = Collections.emptyList() + perPackageOptions = new ArrayList() + impliedPlatforms = Collections. emptyList() externalDocumentationLinks = new ArrayList() noStdlibLink = false - cacheRoot = null as String languageVersion = null as String apiVersion = null as String - kotlinTasks(new Callable>() { - @Override - List call() { - return defaultKotlinTasks() - } - }) - linkMapping(new Action() { - @Override - void execute(LinkMapping mapping) { - mapping.dir = "some String" - mapping.url = "some String" - } - }) - sourceRoot(new Action() { + sourceRoot(new Action() { @Override - void execute(SourceRoot sourceRoot) { + void execute(GradleSourceRootImpl sourceRoot) { sourceRoot.path = "some String" } }) - packageOptions(new Action() { + packageOptions(new Action() { @Override - void execute(PackageOptions packageOptions) { + void execute(GradlePackageOptionsImpl packageOptions) { packageOptions.prefix = "some String" } }) -- cgit