From 6f9aaba8e8ac00a663237a576dbe017448f128d3 Mon Sep 17 00:00:00 2001 From: Moritz Lang Date: Mon, 3 Oct 2022 11:58:49 +0200 Subject: [PATCH] Conditionally compile task-local tests --- Tests/LoggingTests/LoggingTest.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/LoggingTests/LoggingTest.swift b/Tests/LoggingTests/LoggingTest.swift index d40ded8..708b941 100644 --- a/Tests/LoggingTests/LoggingTest.swift +++ b/Tests/LoggingTests/LoggingTest.swift @@ -540,6 +540,7 @@ class LoggingTest: XCTestCase { @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) func testLoggingCallsMetadataProviderWithTaskLocalBaggage() throws { + #if swift(>=5.5) && canImport(_Concurrency) let logging = TestLogging() LoggingSystem.bootstrapInternal(logging.make) @@ -576,6 +577,7 @@ class LoggingTest: XCTestCase { enum TestIDKey: BaggageKey { typealias Value = String } + #endif } func testLoggingCallsMetadataProviderWithExplicitlyPassedBaggage() throws { @@ -617,6 +619,7 @@ class LoggingTest: XCTestCase { @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) func testLoggingMergesOneOffMetadataWithProvidedMetadataFromTaskLocalBaggage() throws { + #if swift(>=5.5) && canImport(_Concurrency) let logging = TestLogging() LoggingSystem.bootstrapInternal(logging.make) @@ -634,6 +637,7 @@ class LoggingTest: XCTestCase { logging.history.assertExist(level: .info, message: "test", metadata: ["common": "one-off", "one-off": "42", "provider": "42"]) + #endif } func testLoggingMergesOneOffMetadataWithProvidedMetadataFromExplicitlyPassedBaggage() throws { @@ -656,6 +660,7 @@ class LoggingTest: XCTestCase { @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) func testLoggingPrefersExplicitBaggageOverTaskLocal() { + #if swift(>=5.5) && canImport(_Concurrency) let logging = TestLogging() LoggingSystem.bootstrapInternal(logging.make) @@ -695,10 +700,12 @@ class LoggingTest: XCTestCase { enum TestIDKey: BaggageKey { typealias Value = String } + #endif } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) func testLoggingWithExplicitlyPassedNilBaggageDoesNotPickUpTaskLocalBaggage() { + #if swift(>=5.5) && canImport(_Concurrency) let logging = TestLogging() LoggingSystem.bootstrapInternal(logging.make) @@ -712,6 +719,7 @@ class LoggingTest: XCTestCase { } logging.history.assertExist(level: .info, message: "test", metadata: ["provider": "42"]) + #endif } func testMultiplexMetadataProviderMergesInSpecifiedOrder() {