File tree Expand file tree Collapse file tree 12 files changed +68
-8
lines changed
Examples/BackgroundTasks/Sources
Tests/AWSLambdaRuntimeCoreTests Expand file tree Collapse file tree 12 files changed +68
-8
lines changed Original file line number Diff line number Diff line change 1313//===----------------------------------------------------------------------===//
1414
1515import AWSLambdaRuntime
16+
17+ #if canImport(FoundationEssentials)
18+ import FoundationEssentials
19+ #else
1620import Foundation
21+ #endif
1722
1823struct BackgroundProcessingHandler : LambdaWithBackgroundProcessingHandler {
1924 struct Input : Decodable {
Original file line number Diff line number Diff line change 1414
1515import AWSLambdaRuntimeCore
1616
17+ #if canImport(FoundationEssentials)
18+ import FoundationEssentials
19+ #else
1720import struct Foundation. Date
21+ #endif
1822
1923extension LambdaContext {
2024 var deadlineDate : Date {
Original file line number Diff line number Diff line change 2626//
2727//===----------------------------------------------------------------------===//
2828
29- import Foundation
3029import NIOCore
3130
31+ #if canImport(FoundationEssentials)
32+ import FoundationEssentials
33+ #else
34+ import Foundation
35+ #endif
36+
3237// This is NIO's `NIOFoundationCompat` module which at the moment only adds `ByteBuffer` utility methods
3338// for Foundation's `Data` type.
3439//
Original file line number Diff line number Diff line change 1212//
1313//===----------------------------------------------------------------------===//
1414
15- import Foundation
1615import Logging
1716import NIOConcurrencyHelpers
1817import NIOCore
1918
19+ #if canImport(FoundationEssentials)
20+ import FoundationEssentials
21+ #else
22+ import Foundation
23+ #endif
24+
2025// We need `@unchecked` Sendable here, as `NIOLockedValueBox` does not understand `sending` today.
2126// We don't want to use `NIOLockedValueBox` here anyway. We would love to use Mutex here, but this
2227// sadly crashes the compiler today.
Original file line number Diff line number Diff line change 1212//
1313//===----------------------------------------------------------------------===//
1414
15- import Foundation
15+ import Dispatch
1616import NIOCore
1717import NIOHTTP1
1818import NIOPosix
1919
20+ #if canImport(FoundationEssentials)
21+ import FoundationEssentials
22+ #else
23+ import Foundation
24+ #endif
25+
2026struct MockServer {
2127 private let group : EventLoopGroup
2228 private let host : String
Original file line number Diff line number Diff line change 1212//
1313//===----------------------------------------------------------------------===//
1414
15- import Foundation
1615import NIOHTTP1
1716import Testing
1817
1918@testable import AWSLambdaRuntimeCore
2019
20+ #if canImport(FoundationEssentials)
21+ import FoundationEssentials
22+ #else
23+ import Foundation
24+ #endif
25+
2126@Suite
2227struct InvocationTest {
2328 @Test
Original file line number Diff line number Diff line change 1313//===----------------------------------------------------------------------===//
1414
1515import AWSLambdaRuntimeCore
16- import Foundation
1716import Logging
1817import NIOCore
1918
19+ #if canImport(FoundationEssentials)
20+ import FoundationEssentials
21+ #else
22+ import Foundation
23+ #endif
24+
2025struct LambdaMockWriter : LambdaRuntimeClientResponseStreamWriter {
2126 var underlying : LambdaMockClient
2227
Original file line number Diff line number Diff line change 1212//
1313//===----------------------------------------------------------------------===//
1414
15- import Foundation
1615import NIOCore
1716import Testing
1817
1918@testable import AWSLambdaRuntimeCore
2019
20+ #if canImport(FoundationEssentials)
21+ import FoundationEssentials
22+ #else
23+ import Foundation
24+ #endif
25+
2126@Suite ( " LambdaRequestID tests " )
2227struct LambdaRequestIDTest {
2328 @Test
@@ -100,6 +105,7 @@ struct LambdaRequestIDTest {
100105 #expect( buffer. readableBytes == readableBeforeRead)
101106 }
102107
108+ #if os(macOS)
103109 @Test
104110 func testInitFromNSStringSuccess( ) {
105111 let nsString = NSMutableString ( capacity: 16 )
@@ -121,6 +127,7 @@ struct LambdaRequestIDTest {
121127 #expect( requestID? . uuidString == LambdaRequestID ( uuidString: nsString as String ) ? . uuidString)
122128 #expect( requestID? . uppercased == nsString as String )
123129 }
130+ #endif
124131
125132 @Test
126133 func testUnparse( ) {
Original file line number Diff line number Diff line change 1212//
1313//===----------------------------------------------------------------------===//
1414
15- import Foundation
1615import Logging
1716import NIOCore
1817import Testing
1918
2019@testable import AWSLambdaRuntimeCore
2120
21+ #if canImport(FoundationEssentials)
22+ import FoundationEssentials
23+ #else
24+ import Foundation
25+ #endif
26+
2227@Suite
2328struct LambdaRunLoopTests {
2429 struct MockEchoHandler : StreamingLambdaHandler {
Original file line number Diff line number Diff line change 1212//
1313//===----------------------------------------------------------------------===//
1414
15- import Foundation // for JSON
1615import Logging
1716import NIOCore
1817import NIOHTTP1
1918import NIOPosix
2019
2120@testable import AWSLambdaRuntimeCore
2221
22+ #if canImport(FoundationEssentials)
23+ import FoundationEssentials
24+ #else
25+ import Foundation
26+ #endif
27+
2328func withMockServer< Result> (
2429 behaviour: some LambdaServerBehavior ,
2530 port: Int = 0 ,
You can’t perform that action at this time.
0 commit comments