Minor: check output with errors in scratch tests
This commit is contained in:
@@ -106,7 +106,7 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() {
|
|||||||
fileName.replace(".kts", ".comp.after")
|
fileName.replace(".kts", ".comp.after")
|
||||||
}
|
}
|
||||||
val expectedFile = File(testDataPath, expectedFileName)
|
val expectedFile = File(testDataPath, expectedFileName)
|
||||||
KotlinTestUtils.assertEqualsToFile(expectedFile, actualOutput.toString())
|
KotlinTestUtils.assertEqualsToFile(expectedFile, actualOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun String.inlinePropertiesValues(
|
protected fun String.inlinePropertiesValues(
|
||||||
@@ -116,7 +116,7 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() {
|
|||||||
return replace("~REPL_MODE~", isRepl.toString()).replace("~INTERACTIVE_MODE~", isInteractiveMode.toString())
|
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 doc = myFixture.getDocument(myFixture.file) ?: error("Document for ${myFixture.file.name} is null")
|
||||||
val actualOutput = StringBuilder(myFixture.file.text)
|
val actualOutput = StringBuilder(myFixture.file.text)
|
||||||
for (line in doc.lineCount - 1 downTo 0) {
|
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<InlayScratchFileRenderer> {
|
protected fun getInlays(start: Int = 0, end: Int = myFixture.file.textLength): List<InlayScratchFileRenderer> {
|
||||||
|
|||||||
@@ -17,11 +17,21 @@ import org.junit.runner.RunWith
|
|||||||
class CustomScratchRunActionTest : AbstractScratchRunActionTest() {
|
class CustomScratchRunActionTest : AbstractScratchRunActionTest() {
|
||||||
|
|
||||||
fun testLongCommandLineWithRepl() {
|
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() {
|
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 {
|
private fun getOutput(isRepl: Boolean): String {
|
||||||
@@ -31,7 +41,7 @@ class CustomScratchRunActionTest : AbstractScratchRunActionTest() {
|
|||||||
launchScratch()
|
launchScratch()
|
||||||
waitUntilScratchFinishes()
|
waitUntilScratchFinishes()
|
||||||
|
|
||||||
return getInlays().joinToString().trim()
|
return getFileTextWithInlays()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val library: Library by lazy {
|
private val library: Library by lazy {
|
||||||
|
|||||||
Reference in New Issue
Block a user