mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IDE] SR-5745 Refactoring: converting strings concatenation expression to strings interpolation (#11944)
This commit is contained in:
@@ -203,6 +203,14 @@ func testExtraIfNestedIf() {
|
||||
let b = 0
|
||||
}
|
||||
}
|
||||
|
||||
func testStringInterpolation() -> String {
|
||||
let name = "Jason"
|
||||
let one = "\(1)"
|
||||
let _ = "aaa" + "bbb"
|
||||
let _ = name + "Bourne"
|
||||
let _ = name + one
|
||||
}
|
||||
// RUN: %refactor -source-filename %s -pos=2:1 -end-pos=5:13 | %FileCheck %s -check-prefix=CHECK1
|
||||
// RUN: %refactor -source-filename %s -pos=3:1 -end-pos=5:13 | %FileCheck %s -check-prefix=CHECK1
|
||||
// RUN: %refactor -source-filename %s -pos=4:1 -end-pos=5:13 | %FileCheck %s -check-prefix=CHECK1
|
||||
@@ -279,6 +287,10 @@ func testExtraIfNestedIf() {
|
||||
// RUN: %refactor -source-filename %s -pos=193:3 | %FileCheck %s -check-prefix=CHECK-NONE
|
||||
// RUN: %refactor -source-filename %s -pos=201:3 | %FileCheck %s -check-prefix=CHECK-NONE
|
||||
|
||||
// RUN: %refactor -source-filename %s -pos=210:11 -end-pos=210:24 | %FileCheck %s -check-prefix=CHECK-STRINGS-INTERPOLATION
|
||||
// RUN: %refactor -source-filename %s -pos=211:11 -end-pos=211:26 | %FileCheck %s -check-prefix=CHECK-STRINGS-INTERPOLATION
|
||||
// RUN: %refactor -source-filename %s -pos=212:11 -end-pos=212:21 | %FileCheck %s -check-prefix=CHECK-STRINGS-INTERPOLATION
|
||||
|
||||
// CHECK1: Action begins
|
||||
// CHECK1-NEXT: Extract Method
|
||||
// CHECK1-NEXT: Action ends
|
||||
@@ -315,3 +327,6 @@ func testExtraIfNestedIf() {
|
||||
// CHECK-LOCALIZE-STRING: Localize String
|
||||
|
||||
// CHECK-COLLAPSE-NESTED-IF-EXPRESSION: Collapse Nested If Expression
|
||||
|
||||
// CHECK-STRINGS-INTERPOLATION: Convert to String Interpolation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user