Files
swift-mirror/test/refactoring/ExtractRepeat/basic.swift
Saleem Abdulrasool b67d5f0cf7 test: convert rm -rf && mkdir -p into %empty-directory
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.
2018-03-06 14:30:54 -08:00

17 lines
822 B
Swift

func foo1() -> Int { return 0 }
func foo(_ a : Int) -> Int {
let a1 = 1 + 2 + 2 + 2 + a + foo1()
let a2 = 1 + 2 + 2 + 2 + a + foo1()
let a3 = 1 + 2 + 2 + 2 + a + foo1()
return foo1() + foo1() + foo1() + a1 + a2 + a3
}
// RUN: %empty-directory(%t.result)
// RUN: %refactor -extract-repeat -source-filename %s -pos=4:16 -end-pos=4:17 >> %t.result/two.swift
// RUN: diff -u %S/Outputs/basic/two.swift.expected %t.result/two.swift
// RUN: %refactor -extract-repeat -source-filename %s -pos=4:12 -end-pos=4:17 >> %t.result/one-plus-two.swift
// RUN: diff -u %S/Outputs/basic/one-plus-two.swift.expected %t.result/one-plus-two.swift
// RUN: %refactor -extract-repeat -source-filename %s -pos=4:32 -end-pos=4:38 >> %t.result/foo-one.swift
// RUN: diff -u %S/Outputs/basic/foo-one.swift.expected %t.result/foo-one.swift