aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin/model/PackageTest.kt
diff options
context:
space:
mode:
authoraleksZubakov <aleks.zubakov@gmail.com>2018-07-12 20:23:02 +0300
committeraleksZubakov <aleks.zubakov@gmail.com>2018-07-12 20:23:02 +0300
commit742be4ef7c024a5ea6023fb684cd24d1898f37e4 (patch)
tree34fc44ef7ee5afdb7a153367d80872f74ace4937 /core/src/test/kotlin/model/PackageTest.kt
parentb4fcc57ab7f335459131ce105924eeaa5fa77375 (diff)
downloaddokka-742be4ef7c024a5ea6023fb684cd24d1898f37e4.tar.gz
dokka-742be4ef7c024a5ea6023fb684cd24d1898f37e4.tar.bz2
dokka-742be4ef7c024a5ea6023fb684cd24d1898f37e4.zip
Test refactoring, add common platform tests
Diffstat (limited to 'core/src/test/kotlin/model/PackageTest.kt')
-rw-r--r--core/src/test/kotlin/model/PackageTest.kt31
1 files changed, 20 insertions, 11 deletions
diff --git a/core/src/test/kotlin/model/PackageTest.kt b/core/src/test/kotlin/model/PackageTest.kt
index bc8a0e0d..80a2fd56 100644
--- a/core/src/test/kotlin/model/PackageTest.kt
+++ b/core/src/test/kotlin/model/PackageTest.kt
@@ -1,15 +1,14 @@
package org.jetbrains.dokka.tests
-import org.jetbrains.dokka.Content
-import org.jetbrains.dokka.NodeKind
-import org.jetbrains.dokka.PackageOptionsImpl
+import org.jetbrains.dokka.*
import org.jetbrains.kotlin.config.KotlinSourceRoot
import org.junit.Assert.*
import org.junit.Test
-public class PackageTest {
+abstract class BasePackageTest(val analysisPlatform: Platform) {
+ val defaultModelConfig = ModelConfig(analysisPlatform = analysisPlatform)
@Test fun rootPackage() {
- checkSourceExistsAndVerifyModel("testdata/packages/rootPackage.kt") { model ->
+ checkSourceExistsAndVerifyModel("testdata/packages/rootPackage.kt", defaultModelConfig) { model ->
with(model.members.single()) {
assertEquals(NodeKind.Package, kind)
assertEquals("", name)
@@ -22,7 +21,7 @@ public class PackageTest {
}
@Test fun simpleNamePackage() {
- checkSourceExistsAndVerifyModel("testdata/packages/simpleNamePackage.kt") { model ->
+ checkSourceExistsAndVerifyModel("testdata/packages/simpleNamePackage.kt", defaultModelConfig) { model ->
with(model.members.single()) {
assertEquals(NodeKind.Package, kind)
assertEquals("simple", name)
@@ -35,7 +34,7 @@ public class PackageTest {
}
@Test fun dottedNamePackage() {
- checkSourceExistsAndVerifyModel("testdata/packages/dottedNamePackage.kt") { model ->
+ checkSourceExistsAndVerifyModel("testdata/packages/dottedNamePackage.kt", defaultModelConfig) { model ->
with(model.members.single()) {
assertEquals(NodeKind.Package, kind)
assertEquals("dot.name", name)
@@ -53,7 +52,8 @@ public class PackageTest {
roots = arrayOf(
KotlinSourceRoot("testdata/packages/dottedNamePackage.kt"),
KotlinSourceRoot("testdata/packages/simpleNamePackage.kt")
- )
+ ),
+ analysisPlatform = analysisPlatform
)
) { model ->
assertEquals(2, model.members.count())
@@ -81,7 +81,8 @@ public class PackageTest {
roots = arrayOf(
KotlinSourceRoot("testdata/packages/simpleNamePackage.kt"),
KotlinSourceRoot("testdata/packages/simpleNamePackage2.kt")
- )
+ ),
+ analysisPlatform = analysisPlatform
)
) { model ->
assertEquals(1, model.members.count())
@@ -98,7 +99,10 @@ public class PackageTest {
@Test fun classAtPackageLevel() {
verifyModel(
- ModelConfig(roots = arrayOf(KotlinSourceRoot("testdata/packages/classInPackage.kt")))
+ ModelConfig(
+ roots = arrayOf(KotlinSourceRoot("testdata/packages/classInPackage.kt")),
+ analysisPlatform = analysisPlatform
+ )
) { model ->
assertEquals(1, model.members.count())
with(model.members.elementAt(0)) {
@@ -118,7 +122,8 @@ public class PackageTest {
roots = arrayOf(KotlinSourceRoot("testdata/packages/classInPackage.kt")),
perPackageOptions = listOf(
PackageOptionsImpl(prefix = "simple.name", suppress = true)
- )
+ ),
+ analysisPlatform = analysisPlatform
)
) { model ->
assertEquals(1, model.members.count())
@@ -133,3 +138,7 @@ public class PackageTest {
}
}
}
+
+class JSPackageTest : BasePackageTest(Platform.js)
+class JVMPackageTest : BasePackageTest(Platform.jvm)
+class CommonPackageTest : BasePackageTest(Platform.common) \ No newline at end of file