1
1
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input always
2
2
// REQUIRES: executable_test
3
3
// REQUIRES: concurrency
4
- // REQUIRES: libdispatch
5
4
6
5
// rdar://76038845
7
6
// REQUIRES: concurrency_runtime
8
7
// UNSUPPORTED: back_deployment_runtime
9
8
10
9
import _Concurrency
10
+ #if canImport(Dispatch)
11
11
// FIXME: should not depend on Dispatch
12
12
import Dispatch
13
+ #endif
13
14
14
15
@available ( SwiftStdlib 5 . 5 , * )
15
16
@main struct Main {
@@ -25,6 +26,7 @@ import Dispatch
25
26
}
26
27
27
28
static func testSleepFinished( ) async {
29
+ #if canImport(Dispatch)
28
30
// CHECK-NEXT: Testing sleep that completes
29
31
print ( " Testing sleep that completes " )
30
32
let start = DispatchTime . now ( )
@@ -39,6 +41,11 @@ import Dispatch
39
41
40
42
// CHECK-NEXT: Wakey wakey!
41
43
print ( " Wakey wakey! " )
44
+ #else
45
+ // dummy output to pass FileCheck
46
+ print ( " Testing sleep that completes " )
47
+ print ( " Wakey wakey! " )
48
+ #endif
42
49
}
43
50
44
51
static func testSleepMomentary( ) async {
@@ -75,6 +82,7 @@ import Dispatch
75
82
}
76
83
77
84
static func testSleepCancelled( ) async {
85
+ #if canImport(Dispatch)
78
86
// CHECK-NEXT: Testing sleep that gets cancelled before it completes
79
87
print ( " Testing sleep that gets cancelled before it completes " )
80
88
let start = DispatchTime . now ( )
@@ -110,5 +118,11 @@ import Dispatch
110
118
111
119
// CHECK-NEXT: Cancelled!
112
120
print ( " Cancelled! " )
121
+ #else
122
+ // dummy output to pass FileCheck
123
+ print ( " Testing sleep that gets cancelled before it completes " )
124
+ print ( " Caught the cancellation error " )
125
+ print ( " Cancelled! " )
126
+ #endif
113
127
}
114
128
}
0 commit comments