Timer.record(_ duration:) review feedback: XCTSkip on Swift version
This commit is contained in:
parent
9b835a7f6d
commit
fd5b5d28c7
|
|
@ -101,7 +101,7 @@ class MetricsExtensionsTests: XCTestCase {
|
||||||
// tests on Linux in MetricsTests+XCTest don't complain that the func does not exist.
|
// tests on Linux in MetricsTests+XCTest don't complain that the func does not exist.
|
||||||
#if swift(>=5.7)
|
#if swift(>=5.7)
|
||||||
guard #available(iOS 16, macOS 13, tvOS 15, watchOS 8, *) else {
|
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()
|
let metrics = TestMetrics()
|
||||||
|
|
@ -123,6 +123,8 @@ class MetricsExtensionsTests: XCTestCase {
|
||||||
XCTAssertEqual(testTimer.values.first, nanoseconds, "expected value to match")
|
XCTAssertEqual(testTimer.values.first, nanoseconds, "expected value to match")
|
||||||
XCTAssertEqual(testTimer.values[1], Int64.max, "expected to record Int64.max if Durataion overflows")
|
XCTAssertEqual(testTimer.values[1], Int64.max, "expected to record Int64.max if Durataion overflows")
|
||||||
XCTAssertEqual(metrics.timers.count, 1, "timer should have been stored")
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue