@@ -28,9 +28,11 @@ if #available(SwiftStdlib 5.7, *) {
28
28
// Divide by 1000 to get back to a duration with representable components:
29
29
let smallerDuration = duration / 1000
30
30
expectEqual ( smallerDuration. components, ( 170_000_000_000_000_000 , 0 ) )
31
+ #if !os(WASI)
31
32
// Now check that the components of the original value trap:
32
33
expectCrashLater ( )
33
34
let _ = duration. components
35
+ #endif
34
36
}
35
37
36
38
suite. test ( " milliseconds from Double " ) {
@@ -166,9 +168,11 @@ if #available(SwiftStdlib 6.0, *) {
166
168
let minRep = Duration . seconds ( - 166020696663385964544 as Int128 )
167
169
expectEqual ( minRep. _high, - 9_000_000_000_000_000_000 )
168
170
expectEqual ( minRep. _low, 0 )
171
+ #if !os(WASI)
169
172
// Check just above the overflow boundary
170
173
expectCrashLater ( )
171
174
let _ = Duration . seconds ( 170141183460469231732 as Int128 )
175
+ #endif
172
176
}
173
177
174
178
suite. test ( " milliseconds from Int128 " ) {
@@ -184,9 +188,11 @@ if #available(SwiftStdlib 6.0, *) {
184
188
let minRep = Duration . milliseconds ( - 170134320591823194554368 as Int128 )
185
189
expectEqual ( minRep. _high, - 9_223_000_000_000_000_000 )
186
190
expectEqual ( minRep. _low, 0 )
191
+ #if !os(WASI)
187
192
// Check just above the overflow boundary
188
193
expectCrashLater ( )
189
194
let _ = Duration . milliseconds ( 170141183460469231731689 as Int128 )
195
+ #endif
190
196
}
191
197
192
198
suite. test ( " microseconds from Int128 " ) {
@@ -202,9 +208,11 @@ if #available(SwiftStdlib 6.0, *) {
202
208
let minRep = Duration . microseconds ( - 170141182780618614507569152 as Int128 )
203
209
expectEqual ( minRep. _high, - 9_223_372_000_000_000_000 )
204
210
expectEqual ( minRep. _low, 0 )
211
+ #if !os(WASI)
205
212
// Check just above the overflow boundary
206
213
expectCrashLater ( )
207
214
let _ = Duration . microseconds ( 170141183460469231731687304 as Int128 )
215
+ #endif
208
216
}
209
217
210
218
suite. test ( " nanoseconds from Int128 " ) {
@@ -220,8 +228,10 @@ if #available(SwiftStdlib 6.0, *) {
220
228
let minRep = Duration . nanoseconds ( - 170141183444701401161113010176 as Int128 )
221
229
expectEqual ( minRep. _high, - 9_223_372_036_000_000_000 )
222
230
expectEqual ( minRep. _low, 0 )
231
+ #if !os(WASI)
223
232
// Check just above the overflow boundary
224
233
expectCrashLater ( )
225
234
let _ = Duration . nanoseconds ( 170141183460469231731687303716 as Int128 )
235
+ #endif
226
236
}
227
237
}
0 commit comments