Replace appendln with appendLine in project

This commit is contained in:
Alexander Udalov
2020-06-09 21:09:45 +02:00
parent d1c88798df
commit 6e67e1e78d
76 changed files with 405 additions and 402 deletions
@@ -32,7 +32,7 @@ class ServiceLoaderLiteTest : AbstractServiceLoaderLiteTest() {
}
fun testSeveralProcessors() {
val processorsContent = buildString { appendln("test.Foo").appendln("test.Bar") }
val processorsContent = buildString { appendLine("test.Foo").appendLine("test.Bar") }
applyForDirAndJar("test", processors(processorsContent)) { file ->
val impls = ServiceLoaderLite.findImplementations(Processor::class.java, listOf(file))
@@ -98,11 +98,11 @@ class ServiceLoaderLiteTest : AbstractServiceLoaderLiteTest() {
fun testCommentsAndWhitespaces() {
val processorsContent = buildString {
appendln(" test.Foo #comment")
appendln("#comment2")
appendln().appendln()
appendln("test.Bar #anotherComemnt")
appendln("test.Zoo ")
appendLine(" test.Foo #comment")
appendLine("#comment2")
appendLine().appendLine()
appendLine("test.Bar #anotherComemnt")
appendLine("test.Zoo ")
}
applyForDirAndJar("test", processors(processorsContent)) { file ->
@@ -127,7 +127,7 @@ class ServiceLoaderLiteTestWithClassLoader : AbstractServiceLoaderLiteTest() {
private inline fun <reified Intf : Any> impls(vararg impls: KClass<out Intf>): Entry {
val content = buildString {
for (impl in impls) {
appendln(impl.java.name)
appendLine(impl.java.name)
}
}
return Entry("META-INF/services/" + Intf::class.java.name, content)
@@ -206,8 +206,8 @@ class CodeConformanceTest : TestCase() {
for (test in tests) {
if (test.result.isNotEmpty()) {
append(test.message.format(test.result.size, test.result.joinToString("\n")))
appendln()
appendln()
appendLine()
appendLine()
}
}
})
@@ -55,10 +55,10 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
)
val result = buildString {
for (annotationClassId in mapping.moduleData.annotations) {
appendln("@$annotationClassId")
appendLine("@$annotationClassId")
}
for ((fqName, packageParts) in mapping.packageFqName2Parts) {
appendln(fqName)
appendLine(fqName)
for (part in packageParts.parts) {
append(" ")
append(part)
@@ -68,7 +68,7 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
append(facadeName)
append(")")
}
appendln()
appendLine()
}
}
}
@@ -38,20 +38,20 @@ class CompilerFileLimitTest : CompilerSmokeTestBase() {
return buildString {
append("package large\n\n")
(0..size).forEach {
appendln("class Class$it")
appendln("{")
appendln("\tfun foo(): Long = $it")
appendln("}")
appendln("\n")
appendLine("class Class$it")
appendLine("{")
appendLine("\tfun foo(): Long = $it")
appendLine("}")
appendLine("\n")
repeat(2000) {
appendln("// kotlin rules ... and stuff")
appendLine("// kotlin rules ... and stuff")
}
}
appendln("fun main()")
appendln("{")
appendln("\tval result = Class5().foo() + Class$size().foo()")
appendln("\tprintln(result)")
appendln("}")
appendLine("fun main()")
appendLine("{")
appendLine("\tval result = Class5().foo() + Class$size().foo()")
appendLine("\tprintln(result)")
appendLine("}")
}
}
@@ -81,33 +81,33 @@ class CompilerFileLimitTest : CompilerSmokeTestBase() {
return buildString {
append("package usesLarge\n\n")
append("import large.Large\n\n")
appendln("fun main()")
appendln("{")
appendln("\tval result = Large.Class0().foo() + Large.Class$size().foo()")
appendln("\tprintln(result)")
appendln("}")
appendLine("fun main()")
appendLine("{")
appendLine("\tval result = Large.Class0().foo() + Large.Class$size().foo()")
appendLine("\tprintln(result)")
appendLine("}")
}
}
private fun generateLargeJavaFile(size: Int): String {
return buildString {
append("package large;\n\n")
appendln("public class Large")
appendln("{")
appendLine("public class Large")
appendLine("{")
(0..size).forEach {
appendln("\tpublic static class Class$it")
appendln("\t{")
appendln("\t\tpublic long foo()")
appendln("\t\t{")
appendln("\t\t\t return $it;")
appendln("\t\t}")
appendln("\t}")
appendln("\n")
appendLine("\tpublic static class Class$it")
appendLine("\t{")
appendLine("\t\tpublic long foo()")
appendLine("\t\t{")
appendLine("\t\t\t return $it;")
appendLine("\t\t}")
appendLine("\t}")
appendLine("\n")
repeat(2000) {
appendln("// kotlin rules ... and stuff")
appendLine("// kotlin rules ... and stuff")
}
}
appendln("}")
appendLine("}")
}
}
@@ -54,31 +54,31 @@ abstract class AbstractMultiPlatformIntegrationTest : KtUsefulTestCase() {
val jvm2Dest = File(tmpdir, "jvm2").absolutePath.takeIf { jvm2Src != null }
val result = buildString {
appendln("-- Common --")
appendln(K2MetadataCompiler().compile(commonSrc, null, "-d", commonDest, *optionalStdlibCommon))
appendLine("-- Common --")
appendLine(K2MetadataCompiler().compile(commonSrc, null, "-d", commonDest, *optionalStdlibCommon))
if (jvmSrc != null) {
appendln()
appendln("-- JVM --")
appendln(K2JVMCompiler().compile(jvmSrc, commonSrc, "-d", jvmDest!!))
appendLine()
appendLine("-- JVM --")
appendLine(K2JVMCompiler().compile(jvmSrc, commonSrc, "-d", jvmDest!!))
}
if (jsSrc != null) {
appendln()
appendln("-- JS --")
appendln(K2JSCompiler().compile(jsSrc, commonSrc, "-output", jsDest!!))
appendLine()
appendLine("-- JS --")
appendLine(K2JSCompiler().compile(jsSrc, commonSrc, "-output", jsDest!!))
}
if (common2Src != null) {
appendln()
appendln("-- Common (2) --")
appendln(K2MetadataCompiler().compile(common2Src, null, "-d", common2Dest!!, "-cp", commonDest, *optionalStdlibCommon))
appendLine()
appendLine("-- Common (2) --")
appendLine(K2MetadataCompiler().compile(common2Src, null, "-d", common2Dest!!, "-cp", commonDest, *optionalStdlibCommon))
}
if (jvm2Src != null) {
appendln()
appendln("-- JVM (2) --")
appendln(
appendLine()
appendLine("-- JVM (2) --")
appendLine(
K2JVMCompiler().compile(
jvm2Src, common2Src, "-d", jvm2Dest!!,
"-cp", listOfNotNull(commonDest, common2Dest, jvmDest).joinToString(File.pathSeparator)
@@ -110,9 +110,9 @@ abstract class AbstractMultiPlatformIntegrationTest : KtUsefulTestCase() {
"-Xmulti-platform" + mainArguments +
loadExtraArguments(listOfNotNull(sources, commonSources))
)
appendln("Exit code: $exitCode")
appendln("Output:")
appendln(output)
appendLine("Exit code: $exitCode")
appendLine("Output:")
appendLine(output)
}.trimTrailingWhitespacesAndAddNewlineAtEOF().trimEnd('\r', '\n')
private fun loadExtraArguments(sources: List<File>): List<String> = sources.flatMap { source ->
@@ -74,7 +74,7 @@ abstract class AbstractReplInterpreterTest : KtUsefulTestCase() {
val value = StringBuilder()
while (lines.isNotEmpty() && !START_PATTERN.matcher(lines.peek()!!).matches()) {
value.appendln(lines.poll()!!)
value.appendLine(lines.poll()!!)
}
result.add(OneLine(code, value.toString()))
@@ -97,10 +97,10 @@ class CapturedTypeApproximationTest : KotlinTestWithEnvironment() {
val typeParameters = functionFoo.typeParameters
val type = functionFoo.returnType
appendln(testType)
appendLine(testType)
if (bindingContext.diagnostics.noSuppression().any { it.severity == Severity.ERROR }) {
appendln(" compiler error\n")
appendLine(" compiler error\n")
continue
}
@@ -119,9 +119,9 @@ class CapturedTypeApproximationTest : KotlinTestWithEnvironment() {
if (testSubstitution.size > 1) append("${typeParameter.name} = ")
append("${testSubstitution[typeParameter]}. ")
}
appendln("lower: $lower; upper: $upper; substitution: $substitution")
appendLine("lower: $lower; upper: $upper; substitution: $substitution")
}
if (testTypes.lastIndex != index) appendln()
if (testTypes.lastIndex != index) appendLine()
}
}