Skip to content

Commit 42195e7

Browse files
authored
Add availability guards to Duration conversion tests. (#1746)
For some reason the compiler didn't complain at me for not having these, despite it complaining at me (correctly) if they weren't in the runtime. My tests ran locally fine without the guards, but our Bazel builds were failing without them.
1 parent e9b49af commit 42195e7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Tests/SwiftProtobufTests/Test_Duration.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ final class Test_Duration: XCTestCase, PBTestHelpers {
314314
}
315315

316316
func testConvertFromStdlibDuration() throws {
317+
guard #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) else {
318+
throw XCTSkip("Duration is not supported on this platform")
319+
}
320+
317321
// Full precision
318322
do {
319323
let sd = Duration.seconds(123) + .nanoseconds(123_456_789)
@@ -372,6 +376,10 @@ final class Test_Duration: XCTestCase, PBTestHelpers {
372376
}
373377

374378
func testConvertToStdlibDuration() throws {
379+
guard #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) else {
380+
throw XCTSkip("Duration is not supported on this platform")
381+
}
382+
375383
do {
376384
let pd = Google_Protobuf_Duration(seconds: 123, nanos: 123_456_789)
377385
let sd = Duration(pd)

0 commit comments

Comments
 (0)