diff --git a/idea/testData/copyright/MultiComments.kt b/idea/testData/copyright/MultiComments.kt new file mode 100644 index 00000000000..142ae2f6fb4 --- /dev/null +++ b/idea/testData/copyright/MultiComments.kt @@ -0,0 +1,8 @@ +/* PRESENT 1 */ +/* PRESENT 2 */ +// PRESENT 3 +/** ABSENT */ +package/* ABSENT 1 */ normal +/* ABSENT 2 */ + +// COMMENTS: 3 \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/copyright/AbstractUpdateKotlinCopyrightTest.kt b/idea/tests/org/jetbrains/kotlin/copyright/AbstractUpdateKotlinCopyrightTest.kt index 28fbc7e9a5c..374549a00a0 100644 --- a/idea/tests/org/jetbrains/kotlin/copyright/AbstractUpdateKotlinCopyrightTest.kt +++ b/idea/tests/org/jetbrains/kotlin/copyright/AbstractUpdateKotlinCopyrightTest.kt @@ -29,10 +29,11 @@ abstract class AbstractUpdateKotlinCopyrightTest : KotlinLightCodeInsightFixture val comments = UpdateKotlinCopyright.getExistentComments(myFixture.file) for (comment in comments) { val commentText = comment.text - when (commentText) { - "/* PRESENT */" -> {} - "/* ABSENT */" -> { - throw AssertionFailedError("Unexpected comment found") + when { + commentText.contains("PRESENT") -> { + } + commentText.contains("ABSENT") -> { + throw AssertionFailedError("Unexpected comment found: `$commentText`") } else -> { throw AssertionFailedError("A comment with bad directive found: `$commentText`") @@ -40,7 +41,10 @@ abstract class AbstractUpdateKotlinCopyrightTest : KotlinLightCodeInsightFixture } } - Assert.assertEquals("Wrong number of comments found", expectedNumberOfComments, comments.size) + Assert.assertEquals( + "Wrong number of comments found:\n${comments.joinToString(separator = "\n") { it.text }}\n", + expectedNumberOfComments, comments.size + ) } override fun getTestDataPath() = File(PluginTestCaseBase.getTestDataPathBase(), "/copyright").path + File.separator diff --git a/idea/tests/org/jetbrains/kotlin/copyright/UpdateKotlinCopyrightTestGenerated.java b/idea/tests/org/jetbrains/kotlin/copyright/UpdateKotlinCopyrightTestGenerated.java index 7721d7cd1f4..8779105cb76 100644 --- a/idea/tests/org/jetbrains/kotlin/copyright/UpdateKotlinCopyrightTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/copyright/UpdateKotlinCopyrightTestGenerated.java @@ -39,6 +39,11 @@ public class UpdateKotlinCopyrightTestGenerated extends AbstractUpdateKotlinCopy runTest("idea/testData/copyright/Empty.kt"); } + @TestMetadata("MultiComments.kt") + public void testMultiComments() throws Exception { + runTest("idea/testData/copyright/MultiComments.kt"); + } + @TestMetadata("NoPackage.kt") public void testNoPackage() throws Exception { runTest("idea/testData/copyright/NoPackage.kt");