Native, Gradle IT: Fix GeneralNativeIT.testNativeArgsWithSpaces()
This commit is contained in:
+2
-1
@@ -818,7 +818,8 @@ class GeneralNativeIT : BaseGradleIT() {
|
|||||||
build("compileKotlin${nativeHostTargetName.capitalize()}") {
|
build("compileKotlin${nativeHostTargetName.capitalize()}") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
checkNativeCommandLineArguments(":compileKotlin${nativeHostTargetName.capitalize()}") { arguments ->
|
checkNativeCommandLineArguments(":compileKotlin${nativeHostTargetName.capitalize()}") { arguments ->
|
||||||
val escapedQuotedPath = "\"${fileWithSpacesInPath.absolutePath.replace("\"", "\\\"")}\""
|
val escapedQuotedPath =
|
||||||
|
"\"${fileWithSpacesInPath.absolutePath.replace("\\", "\\\\").replace("\"", "\\\"")}\""
|
||||||
assertTrue(
|
assertTrue(
|
||||||
escapedQuotedPath in arguments,
|
escapedQuotedPath in arguments,
|
||||||
"""
|
"""
|
||||||
|
|||||||
+5
-1
@@ -151,6 +151,10 @@ internal abstract class KotlinToolRunner(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun String.toPrettyString(): String =
|
private fun String.toPrettyString(): String =
|
||||||
if (isEmpty()) "\"\"" else escapeStringCharacters(this).let { if (any(Char::isWhitespace)) "\"$it\"" else it }
|
when {
|
||||||
|
isEmpty() -> "\"\""
|
||||||
|
any { it == '"' || it.isWhitespace() } -> '"' + escapeStringCharacters(this) + '"'
|
||||||
|
else -> this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user