Skip to content

Commit 6134ac9

Browse files
authored
Add embedded/wasm/mutex.swift for testing Mutex stdlib type
1 parent 9147fce commit 6134ac9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/embedded/wasm/mutex.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo) | %FileCheck %s
2+
3+
// REQUIRES: executable_test
4+
// REQUIRES: OS=wasip1
5+
// REQUIRES: swift_feature_Embedded
6+
7+
import Mutex
8+
@main struct Main {
9+
static func main() {
10+
let m = Mutex(42)
11+
12+
m.withLock {
13+
puts("Hello \($0)") // CHECK: Hello 42
14+
$0 = 37
15+
}
16+
17+
m.withLock {
18+
puts("Hello \($0)") // CHECK: Hello 37
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)