Don't test parent structure consistency in irrelevant cases

This commit is contained in:
Dmitry Jemerov
2017-09-27 18:01:18 +02:00
parent 61f6db87c4
commit bab2641bed
2 changed files with 14 additions and 4 deletions
@@ -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<PsiElement, String>()
file.accept(object : UastVisitor {
@@ -65,8 +77,6 @@ abstract class AbstractKotlinRenderLogTest : AbstractKotlinUastTest(), RenderLog
super.visitElement(element)
}
})
file.checkContainingFileForAllElements()
}
private fun UFile.checkContainingFileForAllElements() {
@@ -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")