- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathbasic.swift
16 lines (14 loc) · 822 Bytes
/
basic.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
func foo1()->Int{return0}
func foo(_ a :Int)->Int{
leta1=1+2+2+2+ a + foo1()
leta2=1+2+2+2+ a + foo1()
leta3=1+2+2+2+ a + foo1()
returnfoo1()+ 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