From bab2641bed7bb0a3c3355198bad9f848fe0e1c48 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 27 Sep 2017 18:01:18 +0200 Subject: [PATCH] Don't test parent structure consistency in irrelevant cases --- .../tests/AbstractKotlinRenderLogTest.kt | 14 ++++++++++++-- .../uast-kotlin/tests/SimpleKotlinRenderLogTest.kt | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/plugins/uast-kotlin/tests/AbstractKotlinRenderLogTest.kt b/plugins/uast-kotlin/tests/AbstractKotlinRenderLogTest.kt index 05861310bee..b1609330718 100644 --- a/plugins/uast-kotlin/tests/AbstractKotlinRenderLogTest.kt +++ b/plugins/uast-kotlin/tests/AbstractKotlinRenderLogTest.kt @@ -21,8 +21,20 @@ abstract class AbstractKotlinRenderLogTest : AbstractKotlinUastTest(), RenderLog File(File(TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext) override fun check(testName: String, file: UFile) { + check(testName, file, true) + } + + fun check(testName: String, file: UFile, checkParentConsistency: Boolean) { super.check(testName, file) + if (checkParentConsistency) { + checkParentConsistency(file) + } + + file.checkContainingFileForAllElements() + } + + private fun checkParentConsistency(file: UFile) { val parentMap = mutableMapOf() file.accept(object : UastVisitor { @@ -65,8 +77,6 @@ abstract class AbstractKotlinRenderLogTest : AbstractKotlinUastTest(), RenderLog super.visitElement(element) } }) - - file.checkContainingFileForAllElements() } private fun UFile.checkContainingFileForAllElements() { diff --git a/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt b/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt index 24fbb9be153..e0e5ddfe07f 100644 --- a/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt +++ b/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt @@ -27,7 +27,7 @@ class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() { @Test fun testQualifiedConstructorCall() = doTest("QualifiedConstructorCall") - @Test fun testPropertyDelegate() = doTest("PropertyDelegate") + @Test fun testPropertyDelegate() = doTest("PropertyDelegate") { testName, file -> check(testName, file, false) } @Test fun testPropertyWithAnnotation() = doTest("PropertyWithAnnotation") @@ -35,7 +35,7 @@ class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() { @Test fun testInnerClasses() = doTest("InnerClasses") - @Test fun testSimpleScript() = doTest("SimpleScript") + @Test fun testSimpleScript() = doTest("SimpleScript") { testName, file -> check(testName, file, false) } @Test fun testDestructuringDeclaration() = doTest("DestructuringDeclaration")