Timer.record(_ duration:) review feedback: XCTSkip on Swift version

This commit is contained in:
Natik Gadzhi 2023-06-28 14:39:19 -07:00
parent 9b835a7f6d
commit fd5b5d28c7
No known key found for this signature in database
GPG Key ID: E6387D41B53DEE06
1 changed files with 3 additions and 1 deletions

View File

@ -101,7 +101,7 @@ class MetricsExtensionsTests: XCTestCase {
// tests on Linux in MetricsTests+XCTest don't complain that the func does not exist.
#if swift(>=5.7)
guard #available(iOS 16, macOS 13, tvOS 15, watchOS 8, *) else {
throw XCTSkip("Timer.record(_ duration: Duration) is available on Swift 5.7+")
throw XCTSkip("Timer.record(_ duration: Duration) is not available on this platform")
}
let metrics = TestMetrics()
@ -123,6 +123,8 @@ class MetricsExtensionsTests: XCTestCase {
XCTAssertEqual(testTimer.values.first, nanoseconds, "expected value to match")
XCTAssertEqual(testTimer.values[1], Int64.max, "expected to record Int64.max if Durataion overflows")
XCTAssertEqual(metrics.timers.count, 1, "timer should have been stored")
#else
throw XCTSkip("Timer.record(_ duration: Duration) is only available on Swift >=5.7")
#endif
}