From 5b24912e46d831434b8b4a12b0aedcf2b06c77e1 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Sat, 12 Jul 2014 02:41:12 +0400 Subject: Fix tests after adding type/upperbound information to model. --- src/main.kt | 2 +- test/src/model/ClassTest.kt | 21 ++++++--------------- test/src/model/FunctionTest.kt | 27 ++++++++++++++++++--------- test/src/model/PropertyTest.kt | 18 ++++++++++-------- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/main.kt b/src/main.kt index 1edecdcb..e8ef4e2f 100644 --- a/src/main.kt +++ b/src/main.kt @@ -25,8 +25,8 @@ public fun main(args: Array) { val environment = AnalysisEnvironment(MessageCollectorPlainTextToStream.PLAIN_TEXT_TO_SYSTEM_ERR) { /* addClasspath(PathUtil.getJdkClassesRoots()) + addClasspath(PathUtil.getKotlinPathsForCompiler().getRuntimePath()) */ - addClasspath(PathUtil.getKotlinPathsForCompiler().getRuntimePath()) addSources(sources) } diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt index 82d24f16..8032b928 100644 --- a/test/src/model/ClassTest.kt +++ b/test/src/model/ClassTest.kt @@ -18,22 +18,13 @@ public class ClassTest { } } - Test fun genericClass() { - verifyModel("test/data/classes/genericClass.kt") { model -> + Test fun gnClass() { + verifyModel("test/data/classes/emptyClass.kt") { model -> with(model.nodes.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) assertEquals("", doc) - - with(details.single()) { - assertEquals("T", name) - assertEquals(DocumentationNodeKind.TypeParameter, kind) - assertEquals("", doc) - assertTrue(details.none()) - assertTrue(members.none()) - assertTrue(links.none()) - } - + assertTrue(details.none()) assertEquals("", members.single().name) assertTrue(links.none()) } @@ -72,7 +63,7 @@ public class ClassTest { assertEquals("name", name) assertEquals(DocumentationNodeKind.Parameter, kind) assertEquals("", doc) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(links.none()) assertTrue(members.none()) } @@ -105,7 +96,7 @@ public class ClassTest { assertEquals("fn", name) assertEquals("", doc) assertEquals(DocumentationNodeKind.Function, kind) - assertTrue(details.none()) + assertEquals("Unit", details.single().name) assertTrue(links.none()) assertTrue(members.none()) } @@ -135,7 +126,7 @@ public class ClassTest { assertEquals("name", name) assertEquals("", doc) assertEquals(DocumentationNodeKind.Property, kind) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(members.none()) assertTrue(links.none()) } diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt index aa22ee0f..641b70a7 100644 --- a/test/src/model/FunctionTest.kt +++ b/test/src/model/FunctionTest.kt @@ -11,7 +11,7 @@ public class FunctionTest { assertEquals("fn", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("Function fn", doc) - assertTrue(details.none()) + assertEquals("Unit", details.single().name) assertTrue(members.none()) assertTrue(links.none()) } @@ -24,11 +24,14 @@ public class FunctionTest { assertEquals("fn", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("Function with receiver", doc) - with(details.single()) { + assertEquals("Unit", details.elementAt(0).name) + + assertEquals(2, details.count()) + with(details.elementAt(1)) { assertEquals("", name) assertEquals(DocumentationNodeKind.Receiver, kind) assertEquals("", doc) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(members.none()) assertTrue(links.none()) } @@ -45,7 +48,9 @@ public class FunctionTest { assertEquals(DocumentationNodeKind.Function, kind) assertEquals("generic function", doc) - with(details.single()) { + assertEquals(2, details.count()) + assertEquals("Unit", details.elementAt(0).name) + with(details.elementAt(1)) { assertEquals("T", name) assertEquals(DocumentationNodeKind.TypeParameter, kind) assertEquals("", doc) @@ -66,8 +71,9 @@ public class FunctionTest { assertEquals(DocumentationNodeKind.Function, kind) assertEquals("generic function", doc) - assertEquals(2, details.count()) - with(details.elementAt(0)) { + assertEquals(3, details.count()) + assertEquals("Unit", details.elementAt(0).name) + with(details.elementAt(1)) { assertEquals("T", name) assertEquals(DocumentationNodeKind.TypeParameter, kind) assertEquals("", doc) @@ -82,7 +88,7 @@ public class FunctionTest { assertTrue(members.none()) assertTrue(links.none()) } - with(details.elementAt(1)) { + with(details.elementAt(2)) { assertEquals("R", name) assertEquals(DocumentationNodeKind.TypeParameter, kind) assertEquals("", doc) @@ -105,11 +111,14 @@ public class FunctionTest { Function Documentation""" , doc) - with(details.single()) { + + assertEquals(2, details.count()) + assertEquals("Unit", details.elementAt(0).name) + with(details.elementAt(1)) { assertEquals("x", name) assertEquals(DocumentationNodeKind.Parameter, kind) assertEquals("parameter", doc) - assertTrue(details.none()) + assertEquals("Int", details.single().name) assertTrue(members.none()) assertTrue(links.none()) } diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt index 1d30f2ce..ed82bfec 100644 --- a/test/src/model/PropertyTest.kt +++ b/test/src/model/PropertyTest.kt @@ -11,7 +11,7 @@ public class PropertyTest { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) assertEquals("", doc) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(members.none()) assertTrue(links.none()) } @@ -24,7 +24,7 @@ public class PropertyTest { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) assertEquals("", doc) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(members.none()) assertTrue(links.none()) } @@ -37,13 +37,13 @@ public class PropertyTest { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) assertEquals("", doc) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(links.none()) with(members.single()) { assertEquals("", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("", doc) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(links.none()) assertTrue(members.none()) } @@ -57,7 +57,7 @@ public class PropertyTest { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) assertEquals("", doc) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(links.none()) assertEquals(2, members.count()) @@ -65,7 +65,7 @@ public class PropertyTest { assertEquals("", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("", doc) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(links.none()) assertTrue(members.none()) } @@ -73,11 +73,13 @@ public class PropertyTest { assertEquals("", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("", doc) - with(details.single()) { + assertEquals(2, details.count()) + assertEquals("Unit", details.elementAt(0).name) + with(details.elementAt(1)) { assertEquals("value", name) assertEquals(DocumentationNodeKind.Parameter, kind) assertEquals("", doc) - assertTrue(details.none()) + assertEquals("String", details.single().name) assertTrue(links.none()) assertTrue(members.none()) } -- cgit