mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This converts the instances of the pattern for which we have a proper substitution in lit. This will make it easier to replace it appropriately with Windows equivalents.
32 lines
727 B
Swift
32 lines
727 B
Swift
enum MyEnum {
|
|
case Case1
|
|
case Case2
|
|
case Case3
|
|
}
|
|
|
|
func foo2(_ e : MyEnum) -> Int {
|
|
switch e {
|
|
case .Case1:
|
|
break
|
|
case .Case2:
|
|
break
|
|
case .Case3:
|
|
break
|
|
}
|
|
switch e {
|
|
case .Case1:
|
|
return 1
|
|
case .Case2:
|
|
return 2
|
|
case .Case3:
|
|
return 3
|
|
}
|
|
}
|
|
|
|
// RUN: %empty-directory(%t.result)
|
|
// RUN: %refactor -extract-function -source-filename %s -pos=8:1 -end-pos=15:4 >> %t.result/Void.swift
|
|
// RUN: diff -u %S/Outputs/extract_switch/Void.swift.expected %t.result/Void.swift
|
|
// RUN: %empty-directory(%t.result)
|
|
// RUN: %refactor -extract-function -source-filename %s -pos=16:1 -end-pos=23:4 >> %t.result/Int.swift
|
|
// RUN: diff -u %S/Outputs/extract_switch/Int.swift.expected %t.result/Int.swift
|