191: KotlinUastApiTest.kt missed bunch aligning fix

This commit is contained in:
Nicolay Mitropolsky
2019-02-18 17:25:42 +03:00
parent 63a1bba6d9
commit 7dc818d42b
@@ -316,6 +316,44 @@ class KotlinUastApiTest : AbstractKotlinUastTest() {
}
}
@Test
fun testNestedAnnotationParameters() = doTest("AnnotationComplex") { _, file ->
fun UFile.annotationAndParam(refText: String, check: (PsiAnnotation, String?) -> Unit) {
findElementByTextFromPsi<UElement>(refText)
.let { expression ->
val (annotation: PsiAnnotation, paramname: String?) =
getContainingAnnotationEntry(expression) ?: kfail("annotation not found for '$refText' ($expression)")
check(annotation, paramname)
}
}
file.annotationAndParam("sv1") { annotation, paramname ->
assertEquals("Annotation", annotation.qualifiedName)
assertEquals(null, paramname)
}
file.annotationAndParam("sv2") { annotation, paramname ->
assertEquals("Annotation", annotation.qualifiedName)
assertEquals(null, paramname)
}
file.annotationAndParam("sar1") { annotation, paramname ->
assertEquals("Annotation", annotation.qualifiedName)
assertEquals("strings", paramname)
}
file.annotationAndParam("sar2") { annotation, paramname ->
assertEquals("Annotation", annotation.qualifiedName)
assertEquals("strings", paramname)
}
file.annotationAndParam("[sar]1") { annotation, paramname ->
assertEquals("Annotation", annotation.qualifiedName)
assertEquals("strings", paramname)
}
file.annotationAndParam("[sar]2") { annotation, paramname ->
assertEquals("Annotation", annotation.qualifiedName)
assertEquals("strings", paramname)
}
}
@Test
fun testParametersDisorder() = doTest("ParametersDisorder") { _, file ->