From 173119eb04e9a99015cebd2d414e7052193da45f Mon Sep 17 00:00:00 2001 From: Wendell Date: Fri, 16 Aug 2024 15:40:39 +0800 Subject: [PATCH] Update test cases --- .../CodableMacroTests+Diagnostics.swift | 8 ++-- Tests/CodableKitTests/CodableMacroTests.swift | 48 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Tests/CodableKitTests/CodableMacroTests+Diagnostics.swift b/Tests/CodableKitTests/CodableMacroTests+Diagnostics.swift index 7746855..7207eed 100644 --- a/Tests/CodableKitTests/CodableMacroTests+Diagnostics.swift +++ b/Tests/CodableKitTests/CodableMacroTests+Diagnostics.swift @@ -71,14 +71,14 @@ final class CodableKitDiagnosticsTests: XCTestCase { case age } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) age = try container.decode(Int.self, forKey: .age) } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -123,14 +123,14 @@ final class CodableKitDiagnosticsTests: XCTestCase { case age } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) age = try container.decode(Int.self, forKey: .age) } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) diff --git a/Tests/CodableKitTests/CodableMacroTests.swift b/Tests/CodableKitTests/CodableMacroTests.swift index 90791eb..d4262d3 100644 --- a/Tests/CodableKitTests/CodableMacroTests.swift +++ b/Tests/CodableKitTests/CodableMacroTests.swift @@ -37,14 +37,14 @@ final class CodableKitTests: XCTestCase { case age } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) age = try container.decode(Int.self, forKey: .age) } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -85,14 +85,14 @@ final class CodableKitTests: XCTestCase { case age } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) age = try container.decodeIfPresent(Int.self, forKey: .age) ?? 24 } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -134,14 +134,14 @@ final class CodableKitTests: XCTestCase { case age = "currentAge" } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) age = try container.decodeIfPresent(Int.self, forKey: .age) ?? 24 } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -182,14 +182,14 @@ final class CodableKitTests: XCTestCase { case age } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) age = try container.decodeIfPresent(Int?.self, forKey: .age) ?? 24 } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -233,14 +233,14 @@ final class CodableKitTests: XCTestCase { case age } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) age = try container.decodeIfPresent(Int?.self, forKey: .age) ?? 24 } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -285,7 +285,7 @@ final class CodableKitTests: XCTestCase { case explicitNil } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) @@ -293,7 +293,7 @@ final class CodableKitTests: XCTestCase { explicitNil = try container.decodeIfPresent(String?.self, forKey: .explicitNil) ?? nil } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -340,14 +340,14 @@ final class CodableKitTests: XCTestCase { case age } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) age = try container.decode(Int.self, forKey: .age) } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -398,14 +398,14 @@ final class CodableKitTests: XCTestCase { case age } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) age = try container.decode(Int.self, forKey: .age) } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -458,7 +458,7 @@ final class CodableKitTests: XCTestCase { case room } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) @@ -477,7 +477,7 @@ final class CodableKitTests: XCTestCase { } } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -542,7 +542,7 @@ final class CodableKitTests: XCTestCase { case room } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) @@ -561,7 +561,7 @@ final class CodableKitTests: XCTestCase { } } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -626,7 +626,7 @@ final class CodableKitTests: XCTestCase { case room } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) @@ -645,7 +645,7 @@ final class CodableKitTests: XCTestCase { } } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name) @@ -712,7 +712,7 @@ final class CodableKitTests: XCTestCase { case role } - public init(from decoder: Decoder) throws { + public init(from decoder: any Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decode(UUID.self, forKey: .id) name = try container.decode(String.self, forKey: .name) @@ -720,7 +720,7 @@ final class CodableKitTests: XCTestCase { role = (try? container.decodeIfPresent(Role.self, forKey: .role)) ?? .unknown } - public func encode(to encoder: Encoder) throws { + public func encode(to encoder: any Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(id, forKey: .id) try container.encode(name, forKey: .name)