Skip to content

Commit a60a3e7

Browse files
committed
Add executable swift test
1 parent f0fc662 commit a60a3e7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

test/Interpreter/async.swift

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency %s -module-name main -o %t/main
3+
// RUN: %target-codesign %t/main
4+
// RUN: %target-run %t/main | %FileCheck %s
5+
6+
// REQUIRES: concurrency
7+
// UNSUPPORTED: use_os_stdlib
8+
// UNSUPPORTED: CPU=arm64e
9+
10+
11+
func sayHello() async {
12+
print("hello")
13+
}
14+
15+
func sayGeneric<T>(_ msg: T) async {
16+
await sayHello()
17+
print(msg)
18+
}
19+
20+
func sayWithClosure(_ action: () async -> ()) async {
21+
await action()
22+
print("hallo welt")
23+
}
24+
25+
runAsync {
26+
// CHECK: hello
27+
await sayHello()
28+
29+
// CHECK: hello
30+
// CHECK: world
31+
await sayGeneric("world")
32+
33+
34+
// CHECK: hello
35+
// CHECK: and now in german
36+
// CHECK: hallo welt
37+
await sayWithClosure {
38+
await sayHello()
39+
print("and now in german")
40+
}
41+
}

0 commit comments

Comments
 (0)