aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/model/JavaTest.kt
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-07-02 13:21:00 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-07-13 14:47:37 +0200
commitb67f44943bc80dedd70c4a9e120b9c6aec78ca72 (patch)
tree349a417b0ed67e1220b4d7c3c82800a7d3a956bd /plugins/base/src/test/kotlin/model/JavaTest.kt
parentf042de920724f6e2ae4ccbcb21baed6b490290ab (diff)
downloaddokka-b67f44943bc80dedd70c4a9e120b9c6aec78ca72.tar.gz
dokka-b67f44943bc80dedd70c4a9e120b9c6aec78ca72.tar.bz2
dokka-b67f44943bc80dedd70c4a9e120b9c6aec78ca72.zip
Draft for showing only first level of inheritance
Diffstat (limited to 'plugins/base/src/test/kotlin/model/JavaTest.kt')
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt134
1 files changed, 14 insertions, 120 deletions
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index 4cad784b..1f042304 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -54,38 +54,19 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
}
- //@Test fun function() {
- // verifyJavaPackageMember("testdata/java/member.java", defaultModelConfig) { cls ->
- // assertEquals("Test", cls.name)
- // assertEquals(NodeKind.Class, cls.kind)
- // with(cls.members(NodeKind.Function).single()) {
- // assertEquals("fn", name)
- // assertEquals("Summary for Function", content.summary.toTestString().trimEnd())
- // assertEquals(3, content.sections.size)
- // with(content.sections[0]) {
- // assertEquals("Parameters", tag)
- // assertEquals("name", subjectName)
- // assertEquals("render(Type:String,SUMMARY): is String parameter", toTestString())
- // }
- // with(content.sections[1]) {
- // assertEquals("Parameters", tag)
- // assertEquals("value", subjectName)
- // assertEquals("render(Type:Int,SUMMARY): is int parameter", toTestString())
- // }
- // assertEquals("Unit", detail(NodeKind.Type).name)
- // assertTrue(members.none())
- // assertTrue(links.none())
- // with(details.first { it.name == "name" }) {
- // assertEquals(NodeKind.Parameter, kind)
- // assertEquals("String", detail(NodeKind.Type).name)
- // }
- // with(details.first { it.name == "value" }) {
- // assertEquals(NodeKind.Parameter, kind)
- // assertEquals("Int", detail(NodeKind.Type).name)
- // }
- // }
- // }
- // }
+ @Test fun multipleClassInheritanceWithInterface() {
+ inlineModelTest(
+ """
+ |interface Highest { }
+ |interface Lower extends Highest { }
+ |class Extendable { }
+ |class Tested extends Extendable implements Lower { }
+ """){
+ with((this / "java" / "Tested").cast<DClass>()) {
+ supertypes.entries.single().value.map { it.dri.sureClassNames to it.kind }.sortedBy { it.first } equals listOf("Extendable" to JavaClassKindTypes.CLASS, "Lower" to JavaClassKindTypes.INTERFACE)
+ }
+ }
+ }
@Test // todo
fun memberWithModifiers() {
@@ -107,19 +88,6 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
}
- // @Test fun memberWithModifiers() {
- // verifyJavaPackageMember("testdata/java/memberWithModifiers.java", defaultModelConfig) { cls ->
- // val modifiers = cls.details(NodeKind.Modifier).map { it.name }
- // assertTrue("abstract" in modifiers)
- // with(cls.members.single { it.name == "fn" }) {
- // assertEquals("protected", details[0].name)
- // }
- // with(cls.members.single { it.name == "openFn" }) {
- // assertEquals("open", details[1].name)
- // }
- // }
- // }
-
@Test
fun superClass() {
inlineModelTest(
@@ -130,7 +98,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
with((this / "java" / "Foo").cast<DClass>()) {
val sups = listOf("Exception", "Cloneable")
assertTrue(
- sups.all { s -> supertypes.values.flatten().any { it.classNames == s } })
+ sups.all { s -> supertypes.values.flatten().any { it.dri.classNames == s } })
"Foo must extend ${sups.joinToString(", ")}"
}
}
@@ -178,25 +146,6 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
}
- // @Test fun typeParameter() {
- // verifyJavaPackageMember("testdata/java/typeParameter.java", defaultModelConfig) { cls ->
- // val typeParameters = cls.details(NodeKind.TypeParameter)
- // with(typeParameters.single()) {
- // assertEquals("T", name)
- // with(detail(NodeKind.UpperBound)) {
- // assertEquals("Comparable", name)
- // assertEquals("T", detail(NodeKind.Type).name)
- // }
- // }
- // with(cls.members(NodeKind.Function).single()) {
- // val methodTypeParameters = details(NodeKind.TypeParameter)
- // with(methodTypeParameters.single()) {
- // assertEquals("E", name)
- // }
- // }
- // }
- // }
-
@Test
fun constructors() {
inlineModelTest(
@@ -290,19 +239,6 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
}
- // @Test fun fields() {
- // verifyJavaPackageMember("testdata/java/field.java", defaultModelConfig) { cls ->
- // val i = cls.members(NodeKind.Property).single { it.name == "i" }
- // assertEquals("Int", i.detail(NodeKind.Type).name)
- // assertTrue("var" in i.details(NodeKind.Modifier).map { it.name })
- //
- // val s = cls.members(NodeKind.Property).single { it.name == "s" }
- // assertEquals("String", s.detail(NodeKind.Type).name)
- // assertFalse("var" in s.details(NodeKind.Modifier).map { it.name })
- // assertTrue("static" in s.details(NodeKind.Modifier).map { it.name })
- // }
- // }
-
@Test
fun staticMethod() {
inlineModelTest(
@@ -321,25 +257,6 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
}
- // @Test fun staticMethod() { todo
- // verifyJavaPackageMember("testdata/java/staticMethod.java", defaultModelConfig) { cls ->
- // val m = cls.members(NodeKind.Function).single { it.name == "foo" }
- // assertTrue("static" in m.details(NodeKind.Modifier).map { it.name })
- // }
- // }
- //
- // /**
- // * `@suppress` not supported in Java!
- // *
- // * [Proposed tags](https://www.oracle.com/technetwork/java/javase/documentation/proposed-tags-142378.html)
- // * Proposed tag `@exclude` for it, but not supported yet
- // */
- // @Ignore("@suppress not supported in Java!") @Test fun suppressTag() {
- // verifyJavaPackageMember("testdata/java/suppressTag.java", defaultModelConfig) { cls ->
- // assertEquals(1, cls.members(NodeKind.Function).size)
- // }
- // }
-
@Test
fun annotatedAnnotation() {
inlineModelTest(
@@ -367,13 +284,6 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
}
- // @Test fun deprecation() {
- // verifyJavaPackageMember("testdata/java/deprecation.java", defaultModelConfig) { cls ->
- // val fn = cls.members(NodeKind.Function).single()
- // assertEquals("This should no longer be used", fn.deprecation!!.content.toTestString())
- // }
- // }
-
@Test
fun javaLangObject() {
inlineModelTest(
@@ -389,13 +299,6 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
}
- // @Test fun javaLangObject() {
- // verifyJavaPackageMember("testdata/java/javaLangObject.java", defaultModelConfig) { cls ->
- // val fn = cls.members(NodeKind.Function).single()
- // assertEquals("Any", fn.detail(NodeKind.Type).name)
- // }
- // }
-
@Test
fun enumValues() {
inlineModelTest(
@@ -440,13 +343,4 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
}
}
}
-
- // todo
- // @Test fun inheritorLinks() {
- // verifyJavaPackageMember("testdata/java/InheritorLinks.java", defaultModelConfig) { cls ->
- // val fooClass = cls.members.single { it.name == "Foo" }
- // val inheritors = fooClass.references(RefKind.Inheritor)
- // assertEquals(1, inheritors.size)
- // }
- // }
}