From 35b64fb01d6b4da4b0dab840a787abc84d1bff06 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Fri, 11 Jul 2014 18:44:53 +0400 Subject: Build model using recursive visitor, include packages in model, add test for function with parameters, unify model and node. --- test/data/function.kt | 4 ---- test/data/functions/function.kt | 4 ++++ test/data/functions/functionWithParams.kt | 4 ++++ test/src/TopLevelFunctionTest.kt | 17 +++++++++++++++-- 4 files changed, 23 insertions(+), 6 deletions(-) delete mode 100644 test/data/function.kt create mode 100644 test/data/functions/function.kt create mode 100644 test/data/functions/functionWithParams.kt (limited to 'test') diff --git a/test/data/function.kt b/test/data/function.kt deleted file mode 100644 index 878b017b..00000000 --- a/test/data/function.kt +++ /dev/null @@ -1,4 +0,0 @@ -/** - * doc - */ -fun fn() {} \ No newline at end of file diff --git a/test/data/functions/function.kt b/test/data/functions/function.kt new file mode 100644 index 00000000..878b017b --- /dev/null +++ b/test/data/functions/function.kt @@ -0,0 +1,4 @@ +/** + * doc + */ +fun fn() {} \ No newline at end of file diff --git a/test/data/functions/functionWithParams.kt b/test/data/functions/functionWithParams.kt new file mode 100644 index 00000000..9d3a0ad7 --- /dev/null +++ b/test/data/functions/functionWithParams.kt @@ -0,0 +1,4 @@ +/** + * doc + */ +fun function(x : Int) {} \ No newline at end of file diff --git a/test/src/TopLevelFunctionTest.kt b/test/src/TopLevelFunctionTest.kt index a51b7bdd..dd88a1a0 100644 --- a/test/src/TopLevelFunctionTest.kt +++ b/test/src/TopLevelFunctionTest.kt @@ -7,8 +7,8 @@ import com.jetbrains.dokka.* public class TopLevelFunctionTest { Test fun function() { - verifyFiles("test/data/function.kt") { model -> - val item = model.nodes.single() + verifyFiles("test/data/functions/function.kt") { model -> + val item = model.nodes.single().members.single() assertEquals(DocumentationNodeKind.Function, item.kind) assertEquals("fn", item.name) assertEquals("doc", item.doc) @@ -17,4 +17,17 @@ public class TopLevelFunctionTest { assertTrue(item.links.none()) } } + + Test fun functionWithParams() { + verifyFiles("test/data/functions/functionWithParams.kt") { model -> + val item = model.nodes.single().members.single() + assertEquals(DocumentationNodeKind.Function, item.kind) + assertEquals("function", item.name) + assertEquals("doc", item.doc) + assertEquals("x", item.details.single().name) + + assertTrue(item.members.none()) + assertTrue(item.links.none()) + } + } } \ No newline at end of file -- cgit