mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[terminal] use '\n' as command output line separator in tests
GitOrigin-RevId: 1e40209aaaa7336038adef90e56132a4c36717e0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
41b992f276
commit
04f715635a
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.terminal.block.testApps
|
||||
|
||||
import com.jediterm.core.util.TermSize
|
||||
@@ -35,7 +35,7 @@ object MoveCursorToLineEndAndPrint {
|
||||
else {
|
||||
it + " ".repeat(emptyColumns - 1)
|
||||
}
|
||||
} + textsToPrint.last() + System.lineSeparator()
|
||||
} + textsToPrint.last() + LINE_SEPARATOR
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.terminal.block.testApps
|
||||
|
||||
import org.jetbrains.plugins.terminal.exp.util.TerminalSessionTestUtil
|
||||
@@ -21,8 +21,8 @@ object SimpleTextRepeater {
|
||||
}
|
||||
|
||||
class Item(private val prefix: String, private val withIncrementingId: Boolean, private val withNewLine: Boolean, val count: Int) {
|
||||
fun getTextToPrint(id: Int): String {
|
||||
return prefix + (if (withIncrementingId) id.toString() else "") + (if (withNewLine) System.lineSeparator() else "")
|
||||
internal fun getTextToPrint(id: Int): String {
|
||||
return prefix + (if (withIncrementingId) id.toString() else "") + (if (withNewLine) LINE_SEPARATOR else "")
|
||||
}
|
||||
|
||||
fun toCommandline(): List<String> {
|
||||
@@ -56,4 +56,10 @@ object SimpleTextRepeater {
|
||||
}.joinToString("")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Same line separator as used in block command output and in [com.intellij.openapi.editor.Document].
|
||||
* @see org.jetbrains.plugins.terminal.exp.ShellCommandOutputScraper
|
||||
*/
|
||||
internal const val LINE_SEPARATOR: String = "\n"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.terminal.exp.util
|
||||
|
||||
import com.intellij.execution.Platform
|
||||
@@ -11,7 +11,6 @@ import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase
|
||||
import com.intellij.util.EnvironmentUtil
|
||||
import com.intellij.util.LineSeparator
|
||||
import com.intellij.util.execution.ParametersListUtil
|
||||
import com.jediterm.core.util.TermSize
|
||||
import com.jediterm.terminal.RequestOrigin
|
||||
@@ -118,11 +117,10 @@ internal object TerminalSessionTestUtil {
|
||||
throw RuntimeException(e)
|
||||
}
|
||||
var actualOutput = StringUtil.splitByLinesDontTrim(actualResult.output).joinToString("\n") { it.trimEnd() }
|
||||
val expectedOutputWithLF = StringUtil.convertLineSeparators(expectedOutput, LineSeparator.LF.separatorString)
|
||||
if (expectedOutputWithLF == actualOutput + "\n") {
|
||||
if (expectedOutput == actualOutput + "\n") {
|
||||
actualOutput += "\n"
|
||||
}
|
||||
Assert.assertEquals(stringify(expectedExitCode, expectedOutputWithLF), stringify(actualResult.exitCode, actualOutput))
|
||||
Assert.assertEquals(stringify(expectedExitCode, expectedOutput), stringify(actualResult.exitCode, actualOutput))
|
||||
}
|
||||
|
||||
private fun stringify(exitCode: Int, output: String): String {
|
||||
|
||||
Reference in New Issue
Block a user