-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathproperty-wrapper-split.swift
26 lines (23 loc) · 1.09 KB
/
property-wrapper-split.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@propertyWrapper
struct Wrapper<T> {
var wrappedValue: T
/*split:def*/init(initialValue: T, fieldName: String, special: Bool = false) {
wrappedValue = initialValue
}
}
let /*someValue:def*/someValue = "some"
struct User {
@/*split:call*/Wrapper(fieldName: "bar")
var bar = 10
@/*split:call*/Wrapper(fieldName: {
return /*someValue*/someValue
}(), special: true)
var complex: Int = {
return /*someValue*/someValue.starts(with: "b") ? 43 : 0
}()
}
// RUN: %empty-directory(%t.ranges)
// RUN: %refactor -find-rename-ranges -source-filename %s -pos="someValue" -old-name "someValue" >> %t.ranges/property-wrapper-split-someValue.swift
// RUN: diff -u %S/Outputs/property-wrapper-split/someValue.swift.expected %t.ranges/property-wrapper-split-someValue.swift
// RUN: %refactor -find-rename-ranges -source-filename %s -pos="split" -is-function-like -old-name "init(initialValue:fieldName:special:)" >> %t.ranges/property-wrapper-split-split.swift
// RUN: diff -u %S/Outputs/property-wrapper-split/split.swift.expected %t.ranges/property-wrapper-split-split.swift