Extracted complex string concatenation bytecode test case into separate test data file.
This commit is contained in:
committed by
max-kammerer
parent
d4d5a6011c
commit
fc5eac26cd
+10
@@ -0,0 +1,10 @@
|
|||||||
|
// Uses 3 StringBuilders:
|
||||||
|
// - In return expression
|
||||||
|
// - In argument to 1st call to foo()
|
||||||
|
// - In argument to 2nd call to foo() inside string literal
|
||||||
|
fun test(s1: String, s2: String, s3: String): String {
|
||||||
|
fun foo(s: String) = s
|
||||||
|
return "foo: " + foo(s1 + s2 + " ${foo("\${s3.length} = ${s3.length}")}")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3 NEW java/lang/StringBuilder
|
||||||
@@ -29,13 +29,4 @@ fun test5(s1: String, s2: String, s3: String) =
|
|||||||
fun test6(s1: String, s2: String, s3: String) =
|
fun test6(s1: String, s2: String, s3: String) =
|
||||||
"${"s1:" + "${" " + s1};"} ${"s2:" + "${" " + s2};"} ${"s3:" + "${" " + s3}"}"
|
"${"s1:" + "${" " + s1};"} ${"s2:" + "${" " + s2};"} ${"s3:" + "${" " + s3}"}"
|
||||||
|
|
||||||
// Uses 3 StringBuilders:
|
// 6 NEW java/lang/StringBuilder
|
||||||
// - In return expression
|
|
||||||
// - In argument to 1st call to foo()
|
|
||||||
// - In argument to 2nd call to foo() inside string literal
|
|
||||||
fun test7(s1: String, s2: String, s3: String): String {
|
|
||||||
fun foo(s: String) = s
|
|
||||||
return "foo: " + foo(s1 + s2 + " ${foo("\${s3.length} = ${s3.length}")}")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 9 NEW java/lang/StringBuilder
|
|
||||||
@@ -3214,6 +3214,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("multipleNestedConcat.kt")
|
||||||
|
public void testMultipleNestedConcat() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/multipleNestedConcat.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConcat.kt")
|
@TestMetadata("nestedConcat.kt")
|
||||||
public void testNestedConcat() throws Exception {
|
public void testNestedConcat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/nestedConcat.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/nestedConcat.kt");
|
||||||
|
|||||||
+5
@@ -3214,6 +3214,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("multipleNestedConcat.kt")
|
||||||
|
public void testMultipleNestedConcat() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/multipleNestedConcat.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConcat.kt")
|
@TestMetadata("nestedConcat.kt")
|
||||||
public void testNestedConcat() throws Exception {
|
public void testNestedConcat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/nestedConcat.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/nestedConcat.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user