From cbcc3d2e2eec8aafc2ef657e0e1c4f45eb8ee891 Mon Sep 17 00:00:00 2001 From: Nicolay Mitropolsky Date: Tue, 29 May 2018 16:33:22 +0300 Subject: [PATCH] Test for java-keywords in light-annotations (KT-22883) working with new source-based light annotations --- .../kotlin/asJava/KtLightAnnotationTest.kt | 18 ++++++++++++++++++ .../kotlin/asJava/KtLightAnnotationTest.kt.173 | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/idea/tests/org/jetbrains/kotlin/asJava/KtLightAnnotationTest.kt b/idea/tests/org/jetbrains/kotlin/asJava/KtLightAnnotationTest.kt index 39e59113e53..c5b41db5bfe 100644 --- a/idea/tests/org/jetbrains/kotlin/asJava/KtLightAnnotationTest.kt +++ b/idea/tests/org/jetbrains/kotlin/asJava/KtLightAnnotationTest.kt @@ -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) diff --git a/idea/tests/org/jetbrains/kotlin/asJava/KtLightAnnotationTest.kt.173 b/idea/tests/org/jetbrains/kotlin/asJava/KtLightAnnotationTest.kt.173 index 21b1a031e45..25de982249c 100644 --- a/idea/tests/org/jetbrains/kotlin/asJava/KtLightAnnotationTest.kt.173 +++ b/idea/tests/org/jetbrains/kotlin/asJava/KtLightAnnotationTest.kt.173 @@ -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)