Skip to content

Commit 3aef3fc

Browse files
committed
[test] Add test case for rdar://72199992
1 parent 63b6232 commit 3aef3fc

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
func myAsync() async -> Int { 0 }
2+
func myFoo() -> Int { 0 }
3+
4+
func testExtract() async -> Int {
5+
let new_name = myFoo()
6+
let a = new_name
7+
let b = new_name
8+
let x = await myAsync()
9+
let y = await myAsync()
10+
return a + b + x + y
11+
}
12+
13+
// rdar://72199992
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
func myAsync() async -> Int { 0 }
2+
func myFoo() -> Int { 0 }
3+
4+
func testExtract() async -> Int {
5+
let a = myFoo()
6+
let b = myFoo()
7+
let new_name = await myAsync()
8+
let x = new_name
9+
let y = new_name
10+
return a + b + x + y
11+
}
12+
13+
// rdar://72199992
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
func myAsync() async -> Int { 0 }
2+
func myFoo() -> Int { 0 }
3+
4+
func testExtract() async -> Int {
5+
let a = myFoo()
6+
let b = myFoo()
7+
let x = await myAsync()
8+
let y = await myAsync()
9+
return a + b + x + y
10+
}
11+
12+
// rdar://72199992
13+
// RUN: %empty-directory(%t.result)
14+
// RUN: %refactor -extract-repeat -source-filename %s -pos=5:11 -end-pos=5:18 >> %t.result/one.swift
15+
// RUN: diff -u %S/Outputs/await/one.swift.expected %t.result/one.swift
16+
// RUN: %refactor -extract-repeat -source-filename %s -pos=7:11 -end-pos=7:26 >> %t.result/two.swift
17+
// RUN: diff -u %S/Outputs/await/two.swift.expected %t.result/two.swift

0 commit comments

Comments
 (0)