@@ -9,7 +9,7 @@ import Foundation
99@preconcurrency import Yams
1010import XCTest
1111
12- fileprivate let foundationTestEncoder = { ( ) -> JSONEncoder in
12+ fileprivate func foundationTestEncoder( ) -> JSONEncoder {
1313 let encoder = JSONEncoder ( )
1414 if #available( macOS 10 . 13 , * ) {
1515 encoder. dateEncodingStrategy = . iso8601
@@ -22,25 +22,25 @@ fileprivate let foundationTestEncoder = { () -> JSONEncoder in
2222 encoder. outputFormatting = [ . prettyPrinted, . sortedKeys]
2323 #endif
2424 return encoder
25- } ( )
25+ }
2626
2727func orderUnstableEncode< T: Encodable > ( _ value: T ) throws -> Data {
28- return try foundationTestEncoder. encode ( value)
28+ return try foundationTestEncoder ( ) . encode ( value)
2929}
3030
3131func orderUnstableTestStringFromEncoding< T: Encodable > ( of entity: T ) throws -> String ? {
3232 return String ( data: try orderUnstableEncode ( entity) , encoding: . utf8)
3333}
3434
35- fileprivate let yamsTestEncoder = { ( ) -> YAMLEncoder in
35+ fileprivate func yamsTestEncoder( ) -> YAMLEncoder {
3636 return YAMLEncoder ( )
37- } ( )
37+ }
3838
3939func orderStableYAMLEncode< T: Encodable > ( _ value: T ) throws -> String {
40- return try yamsTestEncoder. encode ( value)
40+ return try yamsTestEncoder ( ) . encode ( value)
4141}
4242
43- fileprivate func buildFoundationTestDecoder( _ userInfo: [ CodingUserInfoKey : Any ] = [ : ] ) -> JSONDecoder {
43+ fileprivate func buildFoundationTestDecoder( _ userInfo: [ CodingUserInfoKey : any Sendable ] = [ : ] ) -> JSONDecoder {
4444 let decoder = JSONDecoder ( )
4545 decoder. userInfo = userInfo
4646 if #available( macOS 10 . 12 , * ) {
@@ -54,18 +54,18 @@ fileprivate func buildFoundationTestDecoder(_ userInfo: [CodingUserInfoKey: Any]
5454 return decoder
5555}
5656
57- fileprivate let foundationTestDecoder = { ( ) -> JSONDecoder in buildFoundationTestDecoder ( ) } ( )
57+ fileprivate func foundationTestDecoder( ) -> JSONDecoder { buildFoundationTestDecoder ( ) }
5858
59- func orderUnstableDecode< T: Decodable > ( _ type: T . Type , from data: Data , userInfo : [ CodingUserInfoKey : Any ] = [ : ] ) throws -> T {
59+ func orderUnstableDecode< T: Decodable > ( _ type: T . Type , from data: Data , userInfo : [ CodingUserInfoKey : any Sendable ] = [ : ] ) throws -> T {
6060 return try buildFoundationTestDecoder ( userInfo) . decode ( T . self, from: data)
6161}
6262
63- fileprivate let yamsTestDecoder = { ( ) -> YAMLDecoder in
63+ fileprivate func yamsTestDecoder( ) -> YAMLDecoder {
6464 return YAMLDecoder ( )
65- } ( )
65+ }
6666
6767func orderStableDecode< T: Decodable > ( _ type: T . Type , from data: Data ) throws -> T {
68- return try yamsTestDecoder. decode ( T . self, from: data)
68+ return try yamsTestDecoder ( ) . decode ( T . self, from: data)
6969}
7070
7171func assertJSONEquivalent( _ str1: String ? , _ str2: String ? , file: StaticString = #file, line: UInt = #line) {
0 commit comments