[IDE] SR-5745 Refactoring: converting strings concatenation expression to strings interpolation (#11944)

This commit is contained in:
Kacper Harasim
2017-09-19 22:37:42 +02:00
committed by Xi Ge
parent c1129188f9
commit 80698a04b0
10 changed files with 193 additions and 1 deletions

View File

@@ -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