<lambda>null1 package org.jetbrains.dokka.tests
2
3 import org.jetbrains.dokka.Content
4 import org.jetbrains.dokka.NodeKind
5 import org.jetbrains.dokka.RefKind
6 import org.junit.Assert.assertEquals
7 import org.junit.Assert.assertTrue
8 import org.junit.Ignore
9 import org.junit.Test
10
11 class PropertyTest {
12 @Test fun valueProperty() {
13 verifyModel("testdata/properties/valueProperty.kt") { model ->
14 with(model.members.single().members.single()) {
15 assertEquals("property", name)
16 assertEquals(NodeKind.Property, kind)
17 assertEquals(Content.Empty, content)
18 assertEquals("String", detail(NodeKind.Type).name)
19 assertTrue(members.none())
20 assertTrue(links.none())
21 }
22 }
23 }
24
25 @Test fun variableProperty() {
26 verifyModel("testdata/properties/variableProperty.kt") { model ->
27 with(model.members.single().members.single()) {
28 assertEquals("property", name)
29 assertEquals(NodeKind.Property, kind)
30 assertEquals(Content.Empty, content)
31 assertEquals("String", detail(NodeKind.Type).name)
32 assertTrue(members.none())
33 assertTrue(links.none())
34 }
35 }
36 }
37
38 @Test fun valuePropertyWithGetter() {
39 verifyModel("testdata/properties/valuePropertyWithGetter.kt") { model ->
40 with(model.members.single().members.single()) {
41 assertEquals("property", name)
42 assertEquals(NodeKind.Property, kind)
43 assertEquals(Content.Empty, content)
44 assertEquals("String", detail(NodeKind.Type).name)
45 assertTrue(links.none())
46 assertTrue(members.none())
47 }
48 }
49 }
50
51 @Test fun variablePropertyWithAccessors() {
52 verifyModel("testdata/properties/variablePropertyWithAccessors.kt") { model ->
53 with(model.members.single().members.single()) {
54 assertEquals("property", name)
55 assertEquals(NodeKind.Property, kind)
56 assertEquals(Content.Empty, content)
57 assertEquals("String", detail(NodeKind.Type).name)
58 val modifiers = details(NodeKind.Modifier).map { it.name }
59 assertTrue("final" in modifiers)
60 assertTrue("public" in modifiers)
61 assertTrue("var" in modifiers)
62 assertTrue(links.none())
63 assertTrue(members.none())
64 }
65 }
66 }
67
68 @Test fun annotatedProperty() {
69 verifyModel("testdata/properties/annotatedProperty.kt", withKotlinRuntime = true) { model ->
70 with(model.members.single().members.single()) {
71 assertEquals(1, annotations.count())
72 with(annotations[0]) {
73 assertEquals("Strictfp", name)
74 assertEquals(Content.Empty, content)
75 assertEquals(NodeKind.Annotation, kind)
76 }
77 }
78 }
79 }
80
81 @Test fun propertyWithReceiver() {
82 verifyModel("testdata/properties/propertyWithReceiver.kt") { model ->
83 with(model.members.single().members.single()) {
84 assertEquals("kotlin.String", name)
85 assertEquals(NodeKind.ExternalClass, kind)
86 with(members.single()) {
87 assertEquals("foobar", name)
88 assertEquals(NodeKind.Property, kind)
89 }
90 }
91 }
92 }
93
94 @Test fun propertyOverride() {
95 verifyModel("testdata/properties/propertyOverride.kt") { model ->
96 with(model.members.single().members.single { it.name == "Bar" }.members.single { it.name == "xyzzy"}) {
97 assertEquals("xyzzy", name)
98 val override = references(RefKind.Override).single().to
99 assertEquals("xyzzy", override.name)
100 assertEquals("Foo", override.owner!!.name)
101 }
102 }
103 }
104
105 @Test fun sinceKotlin() {
106 verifyModel("testdata/properties/sinceKotlin.kt") { model ->
107 with(model.members.single().members.single()) {
108 assertEquals(listOf("Kotlin 1.1"), platforms)
109 }
110 }
111 }
112 }
113