From 955a4f706c54a271473424c817daaeb02bea5cc5 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 5 Dec 2017 18:17:52 +0300 Subject: Update testData --- .../website-html/dataTags/multiplatform.package.html | 18 +++++++++--------- .../dataTagsInGroupNode/multiplatform.html | 6 +++--- .../dataTagsInGroupNode/multiplatform.package.html | 8 ++++---- core/testdata/format/website-html/dropImport.html | 2 +- .../format/website-html/newLinesInImportList.html | 2 +- .../format/website-html/newLinesInSamples.html | 2 +- core/testdata/format/website-html/overloadGroup.html | 2 +- core/testdata/format/website-html/returnTag.html | 8 ++++---- core/testdata/format/website-html/sample.html | 2 +- .../format/website-html/sampleWithAsserts.html | 2 +- 10 files changed, 26 insertions(+), 26 deletions(-) (limited to 'core/testdata/format/website-html') diff --git a/core/testdata/format/website-html/dataTags/multiplatform.package.html b/core/testdata/format/website-html/dataTags/multiplatform.package.html index 15e1fc12..35453ab1 100644 --- a/core/testdata/format/website-html/dataTags/multiplatform.package.html +++ b/core/testdata/format/website-html/dataTags/multiplatform.package.html @@ -1,10 +1,10 @@ -
test / foo
+
test / foo

Package foo

Functions

-

jre7

+

jre7

@@ -12,7 +12,7 @@
-

jre7New

+

jre7New

@@ -20,7 +20,7 @@
-

js

+

js

@@ -28,7 +28,7 @@
-

jsNew

+

jsNew

@@ -36,7 +36,7 @@
-

jvm

+

jvm

@@ -44,7 +44,7 @@
-

jvmNew

+

jvmNew

@@ -52,7 +52,7 @@
-

shared

+

shared

@@ -60,7 +60,7 @@
-

sharedNew

+

sharedNew

diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html index 35773561..3d34fc7e 100644 --- a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html +++ b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.html @@ -1,4 +1,4 @@ - +

Some

typealias Some = SomeCoolJvmClass

Platform and version requirements: JVM

@@ -10,7 +10,7 @@
-

<init>

+

<init>

@@ -25,7 +25,7 @@
-

magic

+

magic

diff --git a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html index 15ae2a5b..c8926a28 100644 --- a/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html +++ b/core/testdata/format/website-html/dataTagsInGroupNode/multiplatform.package.html @@ -1,10 +1,10 @@ - +

Package pack

Types

-

Some

+

Some

@@ -12,7 +12,7 @@
-

SomeCoolJvmClass

+

SomeCoolJvmClass

@@ -25,7 +25,7 @@
-

Some

+

Some

diff --git a/core/testdata/format/website-html/dropImport.html b/core/testdata/format/website-html/dropImport.html index 97ff4a68..e0fcb12b 100644 --- a/core/testdata/format/website-html/dropImport.html +++ b/core/testdata/format/website-html/dropImport.html @@ -1,4 +1,4 @@ - +

foo

fun foo(): Unit
diff --git a/core/testdata/format/website-html/newLinesInImportList.html b/core/testdata/format/website-html/newLinesInImportList.html index 334ed11c..b5a07325 100644 --- a/core/testdata/format/website-html/newLinesInImportList.html +++ b/core/testdata/format/website-html/newLinesInImportList.html @@ -1,4 +1,4 @@ - +

foo

fun foo(): Unit
diff --git a/core/testdata/format/website-html/newLinesInSamples.html b/core/testdata/format/website-html/newLinesInSamples.html index ab70140d..50f875da 100644 --- a/core/testdata/format/website-html/newLinesInSamples.html +++ b/core/testdata/format/website-html/newLinesInSamples.html @@ -1,4 +1,4 @@ - +

foo

fun foo(): Unit
diff --git a/core/testdata/format/website-html/overloadGroup.html b/core/testdata/format/website-html/overloadGroup.html index 3ea7de94..aaba9c96 100644 --- a/core/testdata/format/website-html/overloadGroup.html +++ b/core/testdata/format/website-html/overloadGroup.html @@ -1,4 +1,4 @@ - +

magic

fun magic(spell: String): Int
diff --git a/core/testdata/format/website-html/returnTag.html b/core/testdata/format/website-html/returnTag.html index d4190fa1..7724eaa7 100644 --- a/core/testdata/format/website-html/returnTag.html +++ b/core/testdata/format/website-html/returnTag.html @@ -1,9 +1,9 @@ - +

indexOf

-
fun Foo.indexOf(
    char: Char,
    startIndex: Int = 0,
    ignoreCase: Boolean = false
): Int
-

Returns the index within this string of the first occurrence of the specified character, starting from the specified startIndex.

+
fun Foo.indexOf(
    char: Char,
    startIndex: Int = 0,
    ignoreCase: Boolean = false
): Int
+

Returns the index within this string of the first occurrence of the specified character, starting from the specified startIndex.

Parameters

ignoreCase - true to ignore character case when matching a character. By default false.

-

Returns An index of the first occurrence of char or -1 if none is found.

+

Returns An index of the first occurrence of char or -1 if none is found.

diff --git a/core/testdata/format/website-html/sample.html b/core/testdata/format/website-html/sample.html index d709edc4..1fb26e41 100644 --- a/core/testdata/format/website-html/sample.html +++ b/core/testdata/format/website-html/sample.html @@ -1,4 +1,4 @@ - +

foo

fun foo(): Int
diff --git a/core/testdata/format/website-html/sampleWithAsserts.html b/core/testdata/format/website-html/sampleWithAsserts.html index 11a3a626..e91232f5 100644 --- a/core/testdata/format/website-html/sampleWithAsserts.html +++ b/core/testdata/format/website-html/sampleWithAsserts.html @@ -1,4 +1,4 @@ - +

a

fun a(): String
-- cgit From a838a096da246babd93dc518dec8d2470d1c14f5 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 10 Jan 2018 22:25:11 +0300 Subject: Convert assertFails in kws samples without message properly --- .../KotlinWebsiteSampleProcessingService.kt | 40 ++++++++++++++++------ .../format/website-html/sampleWithAsserts.html | 2 ++ .../format/website-html/sampleWithAsserts.kt | 2 ++ 3 files changed, 33 insertions(+), 11 deletions(-) (limited to 'core/testdata/format/website-html') diff --git a/core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt b/core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt index b12e3a66..4525e9d9 100644 --- a/core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt +++ b/core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt @@ -1,7 +1,10 @@ package org.jetbrains.dokka.Samples import com.google.inject.Inject -import com.intellij.psi.* +import com.intellij.psi.PsiDocumentManager +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiElementVisitor +import com.intellij.psi.PsiWhiteSpace import com.intellij.psi.impl.source.tree.LeafPsiElement import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.dokka.* @@ -61,27 +64,42 @@ open class KotlinWebsiteSampleProcessingService } fun convertAssertFails(expression: KtCallExpression) { - val (message, funcArgument) = expression.valueArguments + val valueArguments = expression.valueArguments + + val funcArgument: KtValueArgument + val message: KtValueArgument? + + if (valueArguments.size == 1) { + message = null + funcArgument = valueArguments.first() + } else { + message = valueArguments.first() + funcArgument = valueArguments.last() + } + builder.apply { - val argument = if (funcArgument.getArgumentExpression() is KtLambdaExpression) - PsiTreeUtil.findChildOfType(funcArgument, KtBlockExpression::class.java)?.text ?: "" - else - funcArgument.text + val argument = funcArgument.extractFunctionalArgumentText() append(argument.lines().joinToString(separator = "\n") { "// $it" }) append(" // ") - append(message.extractStringArgumentValue()) + if (message != null) { + append(message.extractStringArgumentValue()) + } append(" will fail") } } + private fun KtValueArgument.extractFunctionalArgumentText(): String { + return if (getArgumentExpression() is KtLambdaExpression) + PsiTreeUtil.findChildOfType(this, KtBlockExpression::class.java)?.text ?: "" + else + text + } + fun convertAssertFailsWith(expression: KtCallExpression) { val (funcArgument) = expression.valueArguments val (exceptionType) = expression.typeArguments builder.apply { - val argument = if (funcArgument.firstChild is KtLambdaExpression) - PsiTreeUtil.findChildOfType(funcArgument, KtBlockExpression::class.java)?.text ?: "" - else - funcArgument.text + val argument = funcArgument.extractFunctionalArgumentText() append(argument.lines().joinToString(separator = "\n") { "// $it" }) append(" // will fail with ") append(exceptionType.text) diff --git a/core/testdata/format/website-html/sampleWithAsserts.html b/core/testdata/format/website-html/sampleWithAsserts.html index e91232f5..2b2a9ac5 100644 --- a/core/testdata/format/website-html/sampleWithAsserts.html +++ b/core/testdata/format/website-html/sampleWithAsserts.html @@ -14,6 +14,8 @@ println("a() == b() is ${a() == b()}") // true // readSomeFile(File("some.txt")) // reading file now will fail // readSomeFile(File("some.txt")) // will fail with FileNotFoundException +// readSomeFile(File("some.txt")) // will fail + fun indented() { // A neq B println("a() != b() is ${a() != b()}") // false diff --git a/core/testdata/format/website-html/sampleWithAsserts.kt b/core/testdata/format/website-html/sampleWithAsserts.kt index b3bce11d..bb5848e6 100644 --- a/core/testdata/format/website-html/sampleWithAsserts.kt +++ b/core/testdata/format/website-html/sampleWithAsserts.kt @@ -26,6 +26,8 @@ fun sample() { assertFails("reading file now") { readSomeFile(File("some.txt")) } assertFailsWith { readSomeFile(File("some.txt")) } + assertFails { readSomeFile(File("some.txt")) } + fun indented() { assertFalse(a() != b(), "A neq B") } -- cgit