@@ -28,9 +28,11 @@ if #available(SwiftStdlib 5.7, *) {
2828 // Divide by 1000 to get back to a duration with representable components:
2929 let smallerDuration = duration / 1000
3030 expectEqual ( smallerDuration. components, ( 170_000_000_000_000_000 , 0 ) )
31+ #if !os(WASI)
3132 // Now check that the components of the original value trap:
3233 expectCrashLater ( )
3334 let _ = duration. components
35+ #endif
3436 }
3537
3638 suite. test ( " milliseconds from Double " ) {
@@ -166,9 +168,11 @@ if #available(SwiftStdlib 6.0, *) {
166168 let minRep = Duration . seconds ( - 166020696663385964544 as Int128 )
167169 expectEqual ( minRep. _high, - 9_000_000_000_000_000_000 )
168170 expectEqual ( minRep. _low, 0 )
171+ #if !os(WASI)
169172 // Check just above the overflow boundary
170173 expectCrashLater ( )
171174 let _ = Duration . seconds ( 170141183460469231732 as Int128 )
175+ #endif
172176 }
173177
174178 suite. test ( " milliseconds from Int128 " ) {
@@ -184,9 +188,11 @@ if #available(SwiftStdlib 6.0, *) {
184188 let minRep = Duration . milliseconds ( - 170134320591823194554368 as Int128 )
185189 expectEqual ( minRep. _high, - 9_223_000_000_000_000_000 )
186190 expectEqual ( minRep. _low, 0 )
191+ #if !os(WASI)
187192 // Check just above the overflow boundary
188193 expectCrashLater ( )
189194 let _ = Duration . milliseconds ( 170141183460469231731689 as Int128 )
195+ #endif
190196 }
191197
192198 suite. test ( " microseconds from Int128 " ) {
@@ -202,9 +208,11 @@ if #available(SwiftStdlib 6.0, *) {
202208 let minRep = Duration . microseconds ( - 170141182780618614507569152 as Int128 )
203209 expectEqual ( minRep. _high, - 9_223_372_000_000_000_000 )
204210 expectEqual ( minRep. _low, 0 )
211+ #if !os(WASI)
205212 // Check just above the overflow boundary
206213 expectCrashLater ( )
207214 let _ = Duration . microseconds ( 170141183460469231731687304 as Int128 )
215+ #endif
208216 }
209217
210218 suite. test ( " nanoseconds from Int128 " ) {
@@ -220,8 +228,10 @@ if #available(SwiftStdlib 6.0, *) {
220228 let minRep = Duration . nanoseconds ( - 170141183444701401161113010176 as Int128 )
221229 expectEqual ( minRep. _high, - 9_223_372_036_000_000_000 )
222230 expectEqual ( minRep. _low, 0 )
231+ #if !os(WASI)
223232 // Check just above the overflow boundary
224233 expectCrashLater ( )
225234 let _ = Duration . nanoseconds ( 170141183460469231731687303716 as Int128 )
235+ #endif
226236 }
227237}
0 commit comments