From 69dd2988ec98a9fa027fcc805f28efbe8758d476 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 30 Dec 2014 18:47:03 +0100 Subject: support and render annotation parameters --- test/src/TestAPI.kt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/src/TestAPI.kt') diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt index cc09f001..af1b8e52 100644 --- a/test/src/TestAPI.kt +++ b/test/src/TestAPI.kt @@ -7,6 +7,7 @@ import org.jetbrains.dokka.* import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor import java.io.File import kotlin.test.assertEquals +import com.intellij.openapi.application.PathManager public fun verifyModel(vararg files: String, verifier: (DocumentationModule) -> Unit) { val messageCollector = object : MessageCollector { @@ -27,6 +28,8 @@ public fun verifyModel(vararg files: String, verifier: (DocumentationModule) -> } val environment = AnalysisEnvironment(messageCollector) { + val stringRoot = PathManager.getResourceRoot(javaClass(), "/java/lang/String.class") + addClasspath(File(stringRoot)) addSources(files.toList()) } -- cgit From a03a2cc3df9afe714e2a490d86a9110faaecfa24 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 9 Jan 2015 17:56:15 +0100 Subject: remove some redundant code --- test/src/TestAPI.kt | 4 ---- 1 file changed, 4 deletions(-) (limited to 'test/src/TestAPI.kt') diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt index af1b8e52..a88835cd 100644 --- a/test/src/TestAPI.kt +++ b/test/src/TestAPI.kt @@ -37,10 +37,6 @@ public fun verifyModel(vararg files: String, verifier: (DocumentationModule) -> val documentation = environment.withContext { environment, session -> val fragments = environment.getSourceFiles().map { session.getPackageFragment(it.getPackageFqName()) }.filterNotNull().distinct() - val descriptors = hashMapOf>() - for ((name, parts) in fragments.groupBy { it.fqName }) { - descriptors.put(name.asString(), parts.flatMap { it.getMemberScope().getAllDescriptors() }) - } val documentationModule = DocumentationModule("test") val documentationBuilder = DocumentationBuilder(session, options) -- cgit From 7fbff24a81a7bcc453e1c4e30acdcf7b38c68265 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 9 Jan 2015 18:54:06 +0100 Subject: use JUnit for compares; avoid generating trailing whitespace in markdown --- src/Formats/MarkdownFormatService.kt | 5 +++-- test/data/format/annotationClass.md | 2 +- test/data/format/annotations.md | 6 +++--- test/data/format/classWithClassObject.md | 6 +++--- test/src/TestAPI.kt | 5 ++--- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'test/src/TestAPI.kt') diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt index 96f64eec..38fadf7a 100644 --- a/src/Formats/MarkdownFormatService.kt +++ b/src/Formats/MarkdownFormatService.kt @@ -106,14 +106,15 @@ public open class MarkdownFormatService(locationService: LocationService, } override fun appendTableRow(to: StringBuilder, body: () -> Unit) { - to.append("| ") + to.append("|") body() to.appendln() } override fun appendTableCell(to: StringBuilder, body: () -> Unit) { + to.append(" ") body() - to.append(" | ") + to.append(" |") } var outlineLevel = 0 diff --git a/test/data/format/annotationClass.md b/test/data/format/annotationClass.md index bfaa8581..301eff08 100644 --- a/test/data/format/annotationClass.md +++ b/test/data/format/annotationClass.md @@ -14,5 +14,5 @@ annotation class fancy ### Constructors -| [<init>](out.md) | `public fancy()` | +| [<init>](out.md) | `public fancy()` | diff --git a/test/data/format/annotations.md b/test/data/format/annotations.md index 83f79397..e745213e 100644 --- a/test/data/format/annotations.md +++ b/test/data/format/annotations.md @@ -14,17 +14,17 @@ data class Foo ### Constructors -| [<init>](out.md) | `public Foo()` | +| [<init>](out.md) | `public Foo()` | ### Properties -| [x](out.md) | `inline val x: Int` | +| [x](out.md) | `inline val x: Int` | ### Functions -| [bar](out.md) | `inline fun bar(noinline notInlined: () -> Unit): Unit` | +| [bar](out.md) | `inline fun bar(noinline notInlined: () -> Unit): Unit` | diff --git a/test/data/format/classWithClassObject.md b/test/data/format/classWithClassObject.md index f694a76f..796ecce2 100644 --- a/test/data/format/classWithClassObject.md +++ b/test/data/format/classWithClassObject.md @@ -14,17 +14,17 @@ class Klass ### Constructors -| [<init>](out.md) | `public Klass()` | +| [<init>](out.md) | `public Klass()` | ### Class Object Properties -| [x](out.md) | `val x: Int` | +| [x](out.md) | `val x: Int` | ### Class Object Functions -| [foo](out.md) | `fun foo(): Unit` | +| [foo](out.md) | `fun foo(): Unit` | diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt index a88835cd..e559e337 100644 --- a/test/src/TestAPI.kt +++ b/test/src/TestAPI.kt @@ -4,10 +4,9 @@ import org.jetbrains.jet.cli.common.messages.* import com.intellij.openapi.util.* import kotlin.test.fail import org.jetbrains.dokka.* -import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor import java.io.File -import kotlin.test.assertEquals import com.intellij.openapi.application.PathManager +import org.junit.Assert public fun verifyModel(vararg files: String, verifier: (DocumentationModule) -> Unit) { val messageCollector = object : MessageCollector { @@ -55,7 +54,7 @@ public fun verifyOutput(path: String, outputExtension: String, outputGenerator: val output = StringBuilder() outputGenerator(it, output) val expectedOutput = File(path.replace(".kt", outputExtension)).readText() - assertEquals(expectedOutput, output.toString()) + Assert.assertEquals(expectedOutput, output.toString()) } } -- cgit