Test for java-keywords in light-annotations (KT-22883)

working with new source-based light annotations
This commit is contained in:
Nicolay Mitropolsky
2018-05-29 16:33:22 +03:00
parent ad717d5335
commit cbcc3d2e2e
2 changed files with 36 additions and 0 deletions
@@ -554,6 +554,24 @@ class KtLightAnnotationTest : KotlinLightCodeInsightFixtureTestCase() {
}
fun testJavaKeywordsInName() {
myFixture.configureByText(
"AnnotatedClass.kt", """
package my.public.place
annotation class Anno1(val import: String)
@Anno1(import = "full")
class AnnotatedClass
""".trimIndent()
)
val annotations = myFixture.findClass("my.public.place.AnnotatedClass").expectAnnotations(1)
val annotation = annotations.first()
TestCase.assertEquals("my.public.place.Anno1", annotation.qualifiedName)
assertTextAndRange("\"full\"", annotation.findAttributeValue("import")!!)
}
fun testWrongNamesPassed() {
myFixture.configureByText("AnnotatedClass.kt", """
annotation class Anno1(val i:Int , val j: Int)
@@ -555,6 +555,24 @@ class KtLightAnnotationTest : KotlinLightCodeInsightFixtureTestCase() {
}
fun testJavaKeywordsInName() {
myFixture.configureByText(
"AnnotatedClass.kt", """
package my.public.place
annotation class Anno1(val import: String)
@Anno1(import = "full")
class AnnotatedClass
""".trimIndent()
)
val annotations = myFixture.findClass("my.public.place.AnnotatedClass").expectAnnotations(1)
val annotation = annotations.first()
TestCase.assertEquals("my.public.place.Anno1", annotation.qualifiedName)
assertTextAndRange("\"full\"", annotation.findAttributeValue("import")!!)
}
fun testWrongNamesPassed() {
myFixture.configureByText("AnnotatedClass.kt", """
annotation class Anno1(val i:Int , val j: Int)