From 0d0fc1f2bf8f09106e53626bc024298dc91361b8 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 10 Feb 2015 18:32:12 +0100 Subject: distinguish ContentBlock (a ContentNode that has children) from leaf nodes --- test/src/TestAPI.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/src/TestAPI.kt') diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt index b0e23e0f..7db42980 100644 --- a/test/src/TestAPI.kt +++ b/test/src/TestAPI.kt @@ -62,7 +62,7 @@ public fun assertEqualsIgnoringSeparators(expectedOutput: String, output: String Assert.assertEquals(expectedOutput.replace("\r\n", "\n"), output.replace("\r\n", "\n")) } -fun StringBuilder.appendChildren(node: ContentNode): StringBuilder { +fun StringBuilder.appendChildren(node: ContentBlock): StringBuilder { for (child in node.children) { val childText = child.toTestString() append(childText) @@ -89,9 +89,10 @@ fun StringBuilder.appendNode(node: ContentNode): StringBuilder { append(node.node.toString()) append("]") } - else -> { + is ContentBlock -> { appendChildren(node) } + else -> throw IllegalStateException("Don't know how to format node $node") } return this } -- cgit