diff --git a/idea/tests/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt index 4ab429b27c7..bf57a8e3694 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt @@ -106,7 +106,7 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() { fileName.replace(".kts", ".comp.after") } val expectedFile = File(testDataPath, expectedFileName) - KotlinTestUtils.assertEqualsToFile(expectedFile, actualOutput.toString()) + KotlinTestUtils.assertEqualsToFile(expectedFile, actualOutput) } protected fun String.inlinePropertiesValues( @@ -116,7 +116,7 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() { return replace("~REPL_MODE~", isRepl.toString()).replace("~INTERACTIVE_MODE~", isInteractiveMode.toString()) } - private fun getFileTextWithInlays(): StringBuilder { + protected fun getFileTextWithInlays(): String { val doc = myFixture.getDocument(myFixture.file) ?: error("Document for ${myFixture.file.name} is null") val actualOutput = StringBuilder(myFixture.file.text) for (line in doc.lineCount - 1 downTo 0) { @@ -130,7 +130,7 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() { ) } } - return actualOutput + return actualOutput.toString().trim() } protected fun getInlays(start: Int = 0, end: Int = myFixture.file.textLength): List { diff --git a/idea/tests/org/jetbrains/kotlin/idea/scratch/CustomScratchRunActionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/scratch/CustomScratchRunActionTest.kt index 9a1e76f8f30..022019376ee 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/scratch/CustomScratchRunActionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/scratch/CustomScratchRunActionTest.kt @@ -17,11 +17,21 @@ import org.junit.runner.RunWith class CustomScratchRunActionTest : AbstractScratchRunActionTest() { fun testLongCommandLineWithRepl() { - assertEquals("RESULT: res0: kotlin.Int = 1", getOutput(true)) + assertEquals( + """|// REPL_MODE: true + |// INTERACTIVE_MODE: false + |1 // RESULT: res0: kotlin.Int = 1""".trimMargin(), + getOutput(true) + ) } fun testLongCommandLine() { - assertEquals("RESULT: 1", getOutput(false)) + assertEquals( + """|// REPL_MODE: false + |// INTERACTIVE_MODE: false + |1 // RESULT: 1""".trimMargin(), + getOutput(false) + ) } private fun getOutput(isRepl: Boolean): String { @@ -31,7 +41,7 @@ class CustomScratchRunActionTest : AbstractScratchRunActionTest() { launchScratch() waitUntilScratchFinishes() - return getInlays().joinToString().trim() + return getFileTextWithInlays() } private val library: Library by lazy {