-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
motivation: adjust to swift 5.6 changes: * define sendable shims for protocols and structs that may be used in async context * adjust tests * add a test to make sure no warning are emitted
- Loading branch information
Showing
7 changed files
with
103 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Swift Logging API open source project | ||
// | ||
// Copyright (c) 2022 Apple Inc. and the Swift Logging API project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
import Dispatch | ||
@testable import Logging | ||
import XCTest | ||
|
||
class SendableTest: XCTestCase { | ||
#if compiler(>=5.6) | ||
func testSendableLogger() async { | ||
let testLogging = TestLogging() | ||
LoggingSystem.bootstrapInternal(testLogging.make) | ||
|
||
let logger = Logger(label: "test") | ||
let message1 = Logger.Message(stringLiteral: "critical 1") | ||
let message2 = Logger.Message(stringLiteral: "critical 2") | ||
let metadata: Logger.Metadata = ["key": "value"] | ||
|
||
let task = Task.detached { | ||
logger.info("info") | ||
logger.critical(message1) | ||
logger.critical(message2) | ||
logger.warning(.init(stringLiteral: "warning"), metadata: metadata) | ||
} | ||
|
||
await task.value | ||
testLogging.history.assertExist(level: .info, message: "info", metadata: [:]) | ||
testLogging.history.assertExist(level: .critical, message: "critical 1", metadata: [:]) | ||
testLogging.history.assertExist(level: .critical, message: "critical 2", metadata: [:]) | ||
testLogging.history.assertExist(level: .warning, message: "warning", metadata: metadata) | ||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,4 @@ services: | |
|
||
shell: | ||
<<: *common | ||
entrypoint: /bin/bash | ||
entrypoint: /bin/bash -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters