From a77f01b4308945e44d05e7e05dc242512e5132eb Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Sat, 12 Jul 2014 17:38:16 +0400 Subject: Process Modality (final, open, abstract) and Visibility (public, protected, internal, private) --- test/src/model/ClassTest.kt | 27 +++++++++++++++------------ test/src/model/FunctionTest.kt | 28 ++++++++++++++++++---------- test/src/model/PropertyTest.kt | 32 +++++++++++++++++++++++--------- 3 files changed, 56 insertions(+), 31 deletions(-) (limited to 'test/src/model') diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt index 47eeb2ce..05e156f3 100644 --- a/test/src/model/ClassTest.kt +++ b/test/src/model/ClassTest.kt @@ -11,7 +11,7 @@ public class ClassTest { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) - assertTrue(details.none()) + assertEquals(2, details.count()) assertEquals("", members.single().name) assertTrue(links.none()) } @@ -24,7 +24,7 @@ public class ClassTest { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) - assertTrue(details.none()) + assertEquals(2, details.count()) assertEquals("", members.single().name) assertTrue(links.none()) } @@ -37,7 +37,7 @@ public class ClassTest { assertEquals(DocumentationNode.Kind.Object, kind) assertEquals("Obj", name) assertEquals(DocumentationContent.Empty, doc) - assertTrue(details.none()) + assertEquals(2, details.count()) assertTrue(members.none()) assertTrue(links.none()) } @@ -50,7 +50,7 @@ public class ClassTest { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) - assertTrue(details.none()) + assertEquals(2, details.count()) assertTrue(links.none()) assertEquals(1, members.count()) @@ -58,8 +58,9 @@ public class ClassTest { assertEquals("", name) assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNode.Kind.Constructor, kind) - assertEquals(1, details.count()) - with(details.elementAt(0)) { + assertEquals(2, details.count()) + assertEquals("public", details.elementAt(0).name) + with(details.elementAt(1)) { assertEquals("name", name) assertEquals(DocumentationNode.Kind.Parameter, kind) assertEquals(DocumentationContent.Empty, doc) @@ -80,7 +81,7 @@ public class ClassTest { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) - assertTrue(details.none()) + assertEquals(2, details.count()) assertTrue(links.none()) assertEquals(2, members.count()) @@ -88,7 +89,8 @@ public class ClassTest { assertEquals("", name) assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNode.Kind.Constructor, kind) - assertTrue(details.none()) + assertEquals(1, details.count()) + assertEquals("public", details.elementAt(0).name) assertTrue(links.none()) assertTrue(members.none()) } @@ -96,7 +98,7 @@ public class ClassTest { assertEquals("fn", name) assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals("Unit", details.single().name) + assertEquals("Unit", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) assertTrue(members.none()) } @@ -110,7 +112,7 @@ public class ClassTest { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) - assertTrue(details.none()) + assertEquals(2, details.count()) assertTrue(links.none()) assertEquals(2, members.count()) @@ -118,7 +120,8 @@ public class ClassTest { assertEquals("", name) assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNode.Kind.Constructor, kind) - assertTrue(details.none()) + assertEquals(1, details.count()) + assertEquals("public", details.elementAt(0).name) assertTrue(members.none()) assertTrue(links.none()) } @@ -126,7 +129,7 @@ public class ClassTest { assertEquals("name", name) assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNode.Kind.Property, kind) - assertEquals("String", details.single().name) + assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(members.none()) assertTrue(links.none()) } diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt index e501d3c0..331c59ba 100644 --- a/test/src/model/FunctionTest.kt +++ b/test/src/model/FunctionTest.kt @@ -11,7 +11,7 @@ public class FunctionTest { assertEquals("fn", name) assertEquals(DocumentationNode.Kind.Function, kind) assertEquals("Function fn", doc.summary) - assertEquals("Unit", details.single().name) + assertEquals("Unit", detail(DocumentationNode.Kind.Type).name) assertTrue(members.none()) assertTrue(links.none()) } @@ -26,8 +26,10 @@ public class FunctionTest { assertEquals("Function with receiver", doc.summary) assertEquals("Unit", details.elementAt(0).name) - assertEquals(2, details.count()) - with(details.elementAt(1)) { + assertEquals(4, details.count()) + assertEquals("final", details.elementAt(1).name) + assertEquals("internal", details.elementAt(2).name) + with(details.elementAt(3)) { assertEquals("", name) assertEquals(DocumentationNode.Kind.Receiver, kind) assertEquals(DocumentationContent.Empty, doc) @@ -48,9 +50,11 @@ public class FunctionTest { assertEquals(DocumentationNode.Kind.Function, kind) assertEquals("generic function", doc.summary) - assertEquals(2, details.count()) + assertEquals(4, details.count()) assertEquals("Unit", details.elementAt(0).name) - with(details.elementAt(1)) { + assertEquals("final", details.elementAt(1).name) + assertEquals("private", details.elementAt(2).name) + with(details.elementAt(3)) { assertEquals("T", name) assertEquals(DocumentationNode.Kind.TypeParameter, kind) assertEquals(DocumentationContent.Empty, doc) @@ -71,9 +75,11 @@ public class FunctionTest { assertEquals(DocumentationNode.Kind.Function, kind) assertEquals("generic function", doc.summary) - assertEquals(3, details.count()) + assertEquals(5, details.count()) assertEquals("Unit", details.elementAt(0).name) - with(details.elementAt(1)) { + assertEquals("final", details.elementAt(1).name) + assertEquals("public", details.elementAt(2).name) + with(details.elementAt(3)) { assertEquals("T", name) assertEquals(DocumentationNode.Kind.TypeParameter, kind) assertEquals(DocumentationContent.Empty, doc) @@ -88,7 +94,7 @@ public class FunctionTest { assertTrue(members.none()) assertTrue(links.none()) } - with(details.elementAt(2)) { + with(details.elementAt(4)) { assertEquals("R", name) assertEquals(DocumentationNode.Kind.TypeParameter, kind) assertEquals(DocumentationContent.Empty, doc) @@ -112,9 +118,11 @@ Function Documentation""" , doc.summary) - assertEquals(2, details.count()) + assertEquals(4, details.count()) assertEquals("Unit", details.elementAt(0).name) - with(details.elementAt(1)) { + assertEquals("final", details.elementAt(1).name) + assertEquals("internal", details.elementAt(2).name) + with(details.elementAt(3)) { assertEquals("x", name) assertEquals(DocumentationNode.Kind.Parameter, kind) assertEquals("parameter", doc.summary) diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt index 7768af90..07651ce2 100644 --- a/test/src/model/PropertyTest.kt +++ b/test/src/model/PropertyTest.kt @@ -11,7 +11,7 @@ public class PropertyTest { assertEquals("property", name) assertEquals(DocumentationNode.Kind.Property, kind) assertEquals(DocumentationContent.Empty, doc) - assertEquals("String", details.single().name) + assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(members.none()) assertTrue(links.none()) } @@ -24,7 +24,7 @@ public class PropertyTest { assertEquals("property", name) assertEquals(DocumentationNode.Kind.Property, kind) assertEquals(DocumentationContent.Empty, doc) - assertEquals("String", details.single().name) + assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(members.none()) assertTrue(links.none()) } @@ -37,13 +37,13 @@ public class PropertyTest { assertEquals("property", name) assertEquals(DocumentationNode.Kind.Property, kind) assertEquals(DocumentationContent.Empty, doc) - assertEquals("String", details.single().name) + assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) with(members.single()) { assertEquals("", name) assertEquals(DocumentationNode.Kind.Function, kind) assertEquals(DocumentationContent.Empty, doc) - assertEquals("String", details.single().name) + assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) assertTrue(members.none()) } @@ -57,7 +57,19 @@ public class PropertyTest { assertEquals("property", name) assertEquals(DocumentationNode.Kind.Property, kind) assertEquals(DocumentationContent.Empty, doc) - assertEquals("String", details.single().name) + assertEquals(3, details.count()) + with(details.elementAt(0)) { + assertEquals(DocumentationNode.Kind.Type, kind) + assertEquals("String", name) + } + with(details.elementAt(1)) { + assertEquals(DocumentationNode.Kind.Modifier, kind) + assertEquals("final", name) + } + with(details.elementAt(2)) { + assertEquals(DocumentationNode.Kind.Modifier, kind) + assertEquals("internal", name) + } assertTrue(links.none()) assertEquals(2, members.count()) @@ -65,7 +77,7 @@ public class PropertyTest { assertEquals("", name) assertEquals(DocumentationNode.Kind.Function, kind) assertEquals(DocumentationContent.Empty, doc) - assertEquals("String", details.single().name) + assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) assertTrue(members.none()) } @@ -73,13 +85,15 @@ public class PropertyTest { assertEquals("", name) assertEquals(DocumentationNode.Kind.Function, kind) assertEquals(DocumentationContent.Empty, doc) - assertEquals(2, details.count()) + assertEquals(4, details.count()) assertEquals("Unit", details.elementAt(0).name) - with(details.elementAt(1)) { + assertEquals("final", details.elementAt(1).name) + assertEquals("internal", details.elementAt(2).name) + with(details.elementAt(3)) { assertEquals("value", name) assertEquals(DocumentationNode.Kind.Parameter, kind) assertEquals(DocumentationContent.Empty, doc) - assertEquals("String", details.single().name) + assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) assertTrue(members.none()) } -- cgit