From db3350361322b72ba6e63cb557fb5d5ff6475ca4 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Thu, 27 Nov 2025 21:34:51 +0700 Subject: [PATCH 01/29] Update `swift-syntax` version and improve type constraints - [x] Bumped `swift-syntax` dependency to allow up to `603.0.0`. - [x] Added `SendableMetatype` constraint to `NumberCodingStrategy` extension. - [x] Refactored `caseEncodeExpr` in `EnumVariable` for consistent `FunctionCallExprSyntax` usage. --- Package.swift | 2 +- Sources/HelperCoders/ValueCoders/Number.swift | 2 +- .../Variables/Type/EnumVariable.swift | 22 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Package.swift b/Package.swift index b7352bd3c5..76c25ad604 100644 --- a/Package.swift +++ b/Package.swift @@ -20,7 +20,7 @@ let package = Package( .plugin(name: "MetaProtocolCodable", targets: ["MetaProtocolCodable"]), ], dependencies: [ - .package(url: "https://github.com/swiftlang/swift-syntax.git", "509.1.0"..<"602.0.0"), + .package(url: "https://github.com/swiftlang/swift-syntax.git", "509.1.0"..<"603.0.0"), .package(url: "https://github.com/apple/swift-collections.git", from: "1.0.4"), .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.2"), .package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.0.0"), diff --git a/Sources/HelperCoders/ValueCoders/Number.swift b/Sources/HelperCoders/ValueCoders/Number.swift index 24a01c75e0..403642fb49 100644 --- a/Sources/HelperCoders/ValueCoders/Number.swift +++ b/Sources/HelperCoders/ValueCoders/Number.swift @@ -3,7 +3,7 @@ protocol NumberCodingStrategy: ValueCodingStrategy where Value == Self {} public extension ValueCodingStrategy -where Value: Decodable & ExpressibleByIntegerLiteral & LosslessStringConvertible +where Value: Decodable & ExpressibleByIntegerLiteral & LosslessStringConvertible & SendableMetatype { /// Decodes numeric data from the given `decoder`. /// diff --git a/Sources/PluginCore/Variables/Type/EnumVariable.swift b/Sources/PluginCore/Variables/Type/EnumVariable.swift index 3c621b9950..bb5e36479d 100644 --- a/Sources/PluginCore/Variables/Type/EnumVariable.swift +++ b/Sources/PluginCore/Variables/Type/EnumVariable.swift @@ -81,17 +81,17 @@ package struct EnumVariable: TypeVariable, DeclaredVariable { "self = .\(name)" } } - let caseEncodeExpr: CaseCode = { name, variables in - let args = Self.encodingArgs(representing: variables) - let callee: ExprSyntax = ".\(name)" - let fExpr = - if !args.isEmpty { - FunctionCallExprSyntax(callee: callee) { args } - } else { - FunctionCallExprSyntax(calledExpression: callee) {} - } - return ExprSyntax(fExpr) - } + let caseEncodeExpr: CaseCode = { name, variables in + let args = Self.encodingArgs(representing: variables) + let callee: ExprSyntax = ".\(name)" + let fExpr = + if !args.isEmpty { + FunctionCallExprSyntax(calledExpression: callee) { args } + } else { + FunctionCallExprSyntax(calledExpression: callee) {} + } + return ExprSyntax(fExpr) + } self.init( from: decl, in: context, caseDecodeExpr: caseDecodeExpr, caseEncodeExpr: caseEncodeExpr, From a9b3f019b18a8a8c930e5198efc54a1c7a2ec070 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Thu, 27 Nov 2025 21:39:34 +0700 Subject: [PATCH 02/29] Bring indentation back in `EnumVariable.swift` - [x] Corrected indentation for the `caseEncodeExpr` closure to maintain consistent formatting. --- .../Variables/Type/EnumVariable.swift | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Sources/PluginCore/Variables/Type/EnumVariable.swift b/Sources/PluginCore/Variables/Type/EnumVariable.swift index bb5e36479d..4c716693f1 100644 --- a/Sources/PluginCore/Variables/Type/EnumVariable.swift +++ b/Sources/PluginCore/Variables/Type/EnumVariable.swift @@ -81,17 +81,17 @@ package struct EnumVariable: TypeVariable, DeclaredVariable { "self = .\(name)" } } - let caseEncodeExpr: CaseCode = { name, variables in - let args = Self.encodingArgs(representing: variables) - let callee: ExprSyntax = ".\(name)" - let fExpr = - if !args.isEmpty { - FunctionCallExprSyntax(calledExpression: callee) { args } - } else { - FunctionCallExprSyntax(calledExpression: callee) {} - } - return ExprSyntax(fExpr) - } + let caseEncodeExpr: CaseCode = { name, variables in + let args = Self.encodingArgs(representing: variables) + let callee: ExprSyntax = ".\(name)" + let fExpr = + if !args.isEmpty { + FunctionCallExprSyntax(calledExpression: callee) { args } + } else { + FunctionCallExprSyntax(calledExpression: callee) {} + } + return ExprSyntax(fExpr) + } self.init( from: decl, in: context, caseDecodeExpr: caseDecodeExpr, caseEncodeExpr: caseEncodeExpr, From 551c9a1094a127676e1bf604d60b8a6b037c8ba2 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Thu, 27 Nov 2025 22:30:22 +0700 Subject: [PATCH 03/29] Update protocol constraint from `SendableMetatype` to `Sendable` Replaces the `SendableMetatype` constraint with `Sendable` in the `ValueCodingStrategy` extension to align with updated protocol requirements or type definitions. --- Sources/HelperCoders/ValueCoders/Number.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/HelperCoders/ValueCoders/Number.swift b/Sources/HelperCoders/ValueCoders/Number.swift index 403642fb49..60bcc5df08 100644 --- a/Sources/HelperCoders/ValueCoders/Number.swift +++ b/Sources/HelperCoders/ValueCoders/Number.swift @@ -3,7 +3,7 @@ protocol NumberCodingStrategy: ValueCodingStrategy where Value == Self {} public extension ValueCodingStrategy -where Value: Decodable & ExpressibleByIntegerLiteral & LosslessStringConvertible & SendableMetatype +where Value: Decodable & ExpressibleByIntegerLiteral & LosslessStringConvertible & Sendable { /// Decodes numeric data from the given `decoder`. /// From af382dff2664362161bb48263091664e2f690119 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Thu, 27 Nov 2025 22:31:24 +0700 Subject: [PATCH 04/29] Fix enum case encoding for cases without arguments - [x] Refactors `caseEncodeExpr` to return only the case name for enum cases without associated values, avoiding unnecessary parentheses. This improves code generation for enums with simple cases. --- .../Variables/Type/EnumVariable.swift | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Sources/PluginCore/Variables/Type/EnumVariable.swift b/Sources/PluginCore/Variables/Type/EnumVariable.swift index 4c716693f1..3914db3021 100644 --- a/Sources/PluginCore/Variables/Type/EnumVariable.swift +++ b/Sources/PluginCore/Variables/Type/EnumVariable.swift @@ -84,13 +84,19 @@ package struct EnumVariable: TypeVariable, DeclaredVariable { let caseEncodeExpr: CaseCode = { name, variables in let args = Self.encodingArgs(representing: variables) let callee: ExprSyntax = ".\(name)" - let fExpr = - if !args.isEmpty { - FunctionCallExprSyntax(calledExpression: callee) { args } - } else { - FunctionCallExprSyntax(calledExpression: callee) {} - } - return ExprSyntax(fExpr) + if args.isEmpty { + /// No associated values: return just the case name without parentheses + return callee + } else { + let fExpr = FunctionCallExprSyntax( + calledExpression: callee, + leftParen: .leftParenToken(), + arguments: args, + rightParen: .rightParenToken(), + trailingClosure: nil + ) + return ExprSyntax(fExpr) + } } self.init( from: decl, in: context, @@ -878,3 +884,4 @@ fileprivate extension EnumVariable { /// This encoder is passed to each case for encoding. static var contentEncoder: TokenSyntax { "contentEncoder" } } + From 44558a51537794a3eb59639048f2073aaed4c7e5 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Thu, 27 Nov 2025 22:36:59 +0700 Subject: [PATCH 05/29] Align `misuseWithCodable` diagnostics with actual macro output - [x] Update `ConformEncodableTests.misuseWithCodable` to expect four diagnostics. - [x] Ensure diagnostic IDs, messages, fix-its, and line/column positions match emitted results: - [x] Two diagnostics for `@ConformEncodable` at line 1, column 1. - [x] Two diagnostics for `@Codable` at line 2, column 1. - [x] Mirrors the pattern already used in `misuseWithDecodable`. --- Tests/MetaCodableTests/ConformCodableTests.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Tests/MetaCodableTests/ConformCodableTests.swift b/Tests/MetaCodableTests/ConformCodableTests.swift index 6a8a793ceb..3f294cd032 100644 --- a/Tests/MetaCodableTests/ConformCodableTests.swift +++ b/Tests/MetaCodableTests/ConformCodableTests.swift @@ -38,6 +38,15 @@ struct ConformEncodableTests { .init(message: "Remove @ConformEncodable attribute") ] ), + .init( + id: Codable.misuseID, + message: + "@Codable can't be used in combination with @ConformEncodable", + line: 2, column: 1, + fixIts: [ + .init(message: "Remove @Codable attribute") + ] + ), .init( id: ConformEncodable.misuseID, message: @@ -491,3 +500,4 @@ struct ConformDecodableTests { } } } + From 67ab745109c9d5b2354b5b0fb3a1d0ad072a491f Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Wed, 21 Jan 2026 20:17:00 +0700 Subject: [PATCH 06/29] fix: remove unreachable default case warnings for Bool type switches Skip generating default case in switch statements when the header type is Bool, since both true and false cases are already explicitly handled. This eliminates "default will never be executed" compiler warnings in macro-generated code. - Update decodeSwitchExpression to check for Bool type before adding default - Update test expectation to match new behavior - Add inline documentation explaining the Bool type handling --- CHANGELOG.md | 1 + .../Enum/Switcher/TaggedEnumSwitcherVariable.swift | 6 ++++-- Tests/MetaCodableTests/CodedAs/CodedAsTests.swift | 2 -- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcf058a2a8..935b8ba2ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### 🐛 Fixes * fixed optional types not detected with `valueCoder` strategy ([#141](https://github.com/SwiftyLab/MetaCodable/issues/141)) ([5873c3e](https://github.com/SwiftyLab/MetaCodable/commit/5873c3e33ab98e61c06304bfc2a2c93ab199d65d)) +* removed unreachable `default` case warnings for `Bool` type switches in macro-generated code ## [1.5.0](https://github.com/SwiftyLab/MetaCodable/compare/v1.4.0...v1.5.0) (2025-07-08) diff --git a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift index 4d8d33f600..3f4cea9b6a 100644 --- a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift +++ b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift @@ -21,7 +21,9 @@ extension TaggedEnumSwitcherVariable { /// - location: The decoding location. /// - coder: The decoder for cases. /// - context: The context in which to perform the macro expansion. - /// - default: Whether default case is needed. + /// - default: Whether default case is needed. Note that for Bool type, + /// the default case is automatically skipped since both true and false + /// cases are explicitly handled, avoiding unreachable default warnings. /// - forceDecodingReturn: Whether to force explicit `return` statements in each /// switch case. When `true`, adds a `return` statement after the case assignment /// for early exit. Defaults to `false` for backward compatibility. @@ -60,7 +62,7 @@ extension TaggedEnumSwitcherVariable { } } - if `default` { + if `default` && header.type != .bool { SwitchCaseSyntax(label: .default(.init())) { "break" } diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift index 259ff10b44..c29de92d8f 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift @@ -332,8 +332,6 @@ struct CodedAsTests { value = try container.decode(Int.self, forKey: CodingKeys.value) self = .store(key: key, value: value) return - default: - break } } let typeInt: Int? From 37c080c05af13a89002f5375de78465a614ed70e Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Wed, 21 Jan 2026 20:17:12 +0700 Subject: [PATCH 07/29] fix: add SwiftSyntaxMacroExpansion dependency to PluginCore Add explicit SwiftSyntaxMacroExpansion dependency to PluginCore target to resolve Xcode's dependency scanner warnings. The scanner detects that MacroExpansionContext (used extensively in PluginCore) requires this module as a transitive dependency. Applies to both Package.swift and Package@swift-5.swift for Swift 5/6 compatibility. --- Package.swift | 1 + Package@swift-5.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/Package.swift b/Package.swift index 1ae5615a85..f4f03f2d5b 100644 --- a/Package.swift +++ b/Package.swift @@ -35,6 +35,7 @@ let package = Package( .product(name: "SwiftDiagnostics", package: "swift-syntax"), .product(name: "SwiftSyntaxBuilder", package: "swift-syntax"), .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), + .product(name: "SwiftSyntaxMacroExpansion", package: "swift-syntax"), .product(name: "OrderedCollections", package: "swift-collections"), ] ), diff --git a/Package@swift-5.swift b/Package@swift-5.swift index 0c9e959d94..7d82f6fa76 100644 --- a/Package@swift-5.swift +++ b/Package@swift-5.swift @@ -34,6 +34,7 @@ let package = Package( .product(name: "SwiftDiagnostics", package: "swift-syntax"), .product(name: "SwiftSyntaxBuilder", package: "swift-syntax"), .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), + .product(name: "SwiftSyntaxMacroExpansion", package: "swift-syntax"), .product(name: "OrderedCollections", package: "swift-collections"), ] ), From ea720d55c2dae062a8c64dde5ab578ce12392212 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Wed, 21 Jan 2026 20:17:23 +0700 Subject: [PATCH 08/29] chore: add *.dia to gitignore Add Swift dependency analysis files (*.dia) to gitignore as they are temporary build artifacts similar to .d and .o files. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8360953a99..e54808a55b 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ Package.resolved *.o *.d *.swiftdeps* +*.dia # CocoaPods # From 0b3f7dce9950ab14490d224da0eb6965eb729a38 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Wed, 21 Jan 2026 20:17:37 +0700 Subject: [PATCH 09/29] fix: remove duplicate diagnostic expectations in ConformCodableTests Remove duplicate diagnostic test expectations that were incorrectly preserved during merge conflict resolution. --- .../MetaCodableTests/ConformCodableTests.swift | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Tests/MetaCodableTests/ConformCodableTests.swift b/Tests/MetaCodableTests/ConformCodableTests.swift index b6700190a9..d8cd483a91 100644 --- a/Tests/MetaCodableTests/ConformCodableTests.swift +++ b/Tests/MetaCodableTests/ConformCodableTests.swift @@ -47,24 +47,6 @@ struct ConformEncodableTests { .init(message: "Remove @Codable attribute") ] ), - .init( - id: ConformEncodable.misuseID, - message: - "@ConformEncodable can't be used in combination with @Codable", - line: 1, column: 1, - fixIts: [ - .init(message: "Remove @ConformEncodable attribute") - ] - ), - .init( - id: Codable.misuseID, - message: - "@Codable can't be used in combination with @ConformEncodable", - line: 2, column: 1, - fixIts: [ - .init(message: "Remove @Codable attribute") - ] - ), ] ) } From 4a3190a609a19e08a01a575ea300084989431b3a Mon Sep 17 00:00:00 2001 From: Serhii Date: Fri, 30 Jan 2026 12:09:26 +0700 Subject: [PATCH 10/29] Update `CHANGELOG.md` --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 935b8ba2ab..fcf058a2a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,6 @@ ### 🐛 Fixes * fixed optional types not detected with `valueCoder` strategy ([#141](https://github.com/SwiftyLab/MetaCodable/issues/141)) ([5873c3e](https://github.com/SwiftyLab/MetaCodable/commit/5873c3e33ab98e61c06304bfc2a2c93ab199d65d)) -* removed unreachable `default` case warnings for `Bool` type switches in macro-generated code ## [1.5.0](https://github.com/SwiftyLab/MetaCodable/compare/v1.4.0...v1.5.0) (2025-07-08) From a405f1b6459db95013eb0eedf39a6709979f88c0 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 12:29:59 +0700 Subject: [PATCH 11/29] Fix: Handle partial `Bool` coverage in `switch` statements - [x] Fix the `Bool` `switch` optimization to only skip the `default` case when BOTH `true` and `false` values are explicitly present in the switch. - Previously, the default case was incorrectly skipped for all `Bool` switches, breaking macro expansion when `@CodedAs` includes `Bool` values but not all `enum` cases have `Bool` mappings (partial coverage). - [x] Add logic to detect both `true` and `false` values before skipping default - [x] Add `CodedAsMixedTypesTests.swift` test for partial `Bool` coverage scenario with mixed types - [x] Update inline documentation to clarify the behavior --- .../Switcher/TaggedEnumSwitcherVariable.swift | 60 +++++-- .../CodedAs/CodedAsMixedTypesTests.swift | 152 ++++++++++++++++++ 2 files changed, 196 insertions(+), 16 deletions(-) create mode 100644 Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift diff --git a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift index 3f4cea9b6a..71a135995a 100644 --- a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift +++ b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift @@ -11,25 +11,34 @@ import SwiftSyntaxMacros protocol TaggedEnumSwitcherVariable: EnumSwitcherVariable {} extension TaggedEnumSwitcherVariable { - /// Provides the switch expression for decoding. + /// Provides a `switch` expression used to decode a tagged enum variable. /// - /// Based on enum-cases the each case for switch expression is generated. - /// Final expression generated combining all cases with provided parameters. + /// Generates a `switch` over `header` by mapping each eligible enum case in `location` + /// to a corresponding `case` clause. Each generated clause runs `preSyntax` for the + /// matched tag value and then emits the decoding code for that enum case. /// /// - Parameters: - /// - header: The switch header cases are compared to. - /// - location: The decoding location. - /// - coder: The decoder for cases. - /// - context: The context in which to perform the macro expansion. - /// - default: Whether default case is needed. Note that for Bool type, - /// the default case is automatically skipped since both true and false - /// cases are explicitly handled, avoiding unreachable default warnings. - /// - forceDecodingReturn: Whether to force explicit `return` statements in each - /// switch case. When `true`, adds a `return` statement after the case assignment - /// for early exit. Defaults to `false` for backward compatibility. - /// - preSyntax: The callback to generate case variation data. + /// - header: The expression whose value is matched by the `switch`. + /// - location: The decoding location containing tagged enum cases. + /// - coder: The decoder token used by generated decoding code. + /// - context: The macro expansion context. + /// - default: Whether to include a `default` case. + /// - forceDecodingReturn: + /// - When `true`, emits an explicit `return` after each `case` assignment + /// for early exit. + /// - Defaults to `false` for backward compatibility. + /// - preSyntax: A callback used to generate case-variation syntax for the matched + /// tag value. /// - /// - Returns: The generated switch expression. + /// - Important: For `Bool` tags, the `default` case is omitted only when both `true` + /// and `false` are explicitly covered. With partial coverage (only one of the two + /// values), the `default` case is retained. + /// + /// - Returns: A `SwitchExprSyntax` when at least one matching switch case can be + /// generated; otherwise `nil`. + /// + /// - Complexity: `O(𝑛)` in the number of tagged cases in `location`. + /// - Plus the number of tag expressions scanned for `Bool` coverage. func decodeSwitchExpression( over header: EnumVariable.CaseValue.Expr, at location: EnumSwitcherLocation, @@ -40,6 +49,25 @@ extension TaggedEnumSwitcherVariable { preSyntax: (TokenSyntax) -> CodeBlockItemListSyntax ) -> SwitchExprSyntax? { var switchable = false + + /// For `Bool` type, check if both `true` and `false` values are present + var hasBoolTrue = false + var hasBoolFalse = false + if header.type == .bool { + for (_, value) in location.cases { + let boolValues = value.decodeExprs.filter { $0.type == .bool } + for boolValue in boolValues { + let valueStr = boolValue.syntax.trimmedDescription + if valueStr == "true" { + hasBoolTrue = true + } else if valueStr == "false" { + hasBoolFalse = true + } + } + } + } + let skipDefaultForBool = header.type == .bool && hasBoolTrue && hasBoolFalse + let switchExpr = SwitchExprSyntax(subject: header.syntax) { for (`case`, value) in location.cases where `case`.decode ?? true { let values = value.decodeExprs @@ -62,7 +90,7 @@ extension TaggedEnumSwitcherVariable { } } - if `default` && header.type != .bool { + if `default` && !skipDefaultForBool { SwitchCaseSyntax(label: .default(.init())) { "break" } diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift new file mode 100644 index 0000000000..0d19c75c95 --- /dev/null +++ b/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift @@ -0,0 +1,152 @@ +import Foundation +import MetaCodable +import Testing + +@testable import PluginCore + +/// Tests for `@CodedAs` macro with mixed literal types including partial `Bool` coverage. +/// +/// These tests verify that internally tagged enums work correctly when `@CodedAs` +/// specifies multiple literal types (`String`, `Int`, `Bool`) and not all `enum` cases +/// have `Bool` values, resulting in partial `Bool` coverage in `switch` statements. +@Suite("CodedAs Mixed Types Tests") +struct CodedAsMixedTypesTests { + /// Tests macro expansion when `@CodedAs` includes `Bool` values + /// but not all cases have them. + /// + /// This scenario requires the generated `Bool` switch to include a `default` case + /// since only `true` is specified (for `load` case) and `false` is not covered. + @Test("Expansion with partial Bool coverage") + func expansionWithPartialBoolCoverage() throws { + assertMacroExpansion( + """ + @Codable + @CodedAt("type") + enum Command { + @CodedAs("load", 12, true) + case load(key: String) + @CodedAs("store", 30) + case store(key: String, value: Int) + } + """, + expandedSource: + """ + enum Command { + case load(key: String) + case store(key: String, value: Int) + } + + extension Command: Decodable { + init(from decoder: any Decoder) throws { + var typeContainer: KeyedDecodingContainer? + let container = try? decoder.container(keyedBy: CodingKeys.self) + if let container = container { + typeContainer = container + } else { + typeContainer = nil + } + if let typeContainer = typeContainer, let container = container { + let typeBool: Bool? + do { + typeBool = try typeContainer.decodeIfPresent(Bool.self, forKey: CodingKeys.type) ?? nil + } catch { + typeBool = nil + } + if let typeBool = typeBool { + switch typeBool { + case true: + let key: String + let container = try decoder.container(keyedBy: CodingKeys.self) + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + default: + break + } + } + let typeInt: Int? + do { + typeInt = try typeContainer.decodeIfPresent(Int.self, forKey: CodingKeys.type) ?? nil + } catch { + typeInt = nil + } + if let typeInt = typeInt { + switch typeInt { + case 12: + let key: String + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + case 30: + let key: String + let value: Int + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + let typeString: String? + do { + typeString = try typeContainer.decodeIfPresent(String.self, forKey: CodingKeys.type) ?? nil + } catch { + typeString = nil + } + if let typeString = typeString { + switch typeString { + case "load": + let key: String + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + case "store": + let key: String + let value: Int + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + } + let context = DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Couldn't match any cases." + ) + throw DecodingError.typeMismatch(Self.self, context) + } + } + + extension Command: Encodable { + func encode(to encoder: any Encoder) throws { + let container = encoder.container(keyedBy: CodingKeys.self) + var typeContainer = container + switch self { + case .load(key: let key): + try typeContainer.encode("load", forKey: CodingKeys.type) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(key, forKey: CodingKeys.key) + case .store(key: let key, value: let value): + try typeContainer.encode("store", forKey: CodingKeys.type) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(key, forKey: CodingKeys.key) + try container.encode(value, forKey: CodingKeys.value) + } + } + } + + extension Command { + enum CodingKeys: String, CodingKey { + case type = "type" + case key = "key" + case value = "value" + } + } + """ + ) + } +} From 342f6ffdfdb03076ee22aece3d73877e3f22d9a6 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 14:20:40 +0700 Subject: [PATCH 12/29] test: add coverage tests for HelperCoder and related types Add tests for previously uncovered code paths: - HelperCoder: decodeIfPresent, encode, encodeIfPresent - ConditionalCoder: decodeIfPresent, encodeIfPresent - DefaultSequenceElementCoding: optional encoding/decoding methods - DynamicCodableIdentifier: CodingKey conformance methods Also adds: - .markdownlint.json configuration based on existing .md file patterns - Tests/TODO/CoverageTracking.md for tracking test coverage progress --- .markdownlint.json | 11 + .../ConditionalCoderTests.swift | 132 ++++++++++ .../DefaultSequenceElementCodingTests.swift | 177 ++++++++++++++ .../DynamicCodableIdentifierTests.swift | 111 +++++++++ Tests/MetaCodableTests/HelperCoderTests.swift | 226 ++++++++++++++++++ Tests/TODO/CoverageTracking.md | 218 +++++++++++++++++ 6 files changed, 875 insertions(+) create mode 100644 .markdownlint.json create mode 100644 Tests/MetaCodableTests/ConditionalCoderTests.swift create mode 100644 Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift create mode 100644 Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift create mode 100644 Tests/MetaCodableTests/HelperCoderTests.swift create mode 100644 Tests/TODO/CoverageTracking.md diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000000..45571c00e5 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,11 @@ +{ + "default": true, + "MD012": false, + "MD013": false, + "MD024": { + "siblings_only": true + }, + "MD033": false, + "MD041": false, + "MD060": false +} diff --git a/Tests/MetaCodableTests/ConditionalCoderTests.swift b/Tests/MetaCodableTests/ConditionalCoderTests.swift new file mode 100644 index 0000000000..0af00f959b --- /dev/null +++ b/Tests/MetaCodableTests/ConditionalCoderTests.swift @@ -0,0 +1,132 @@ +import Foundation +import HelperCoders +import MetaCodable +import Testing + +/// Tests for `ConditionalCoder` helper coder. +/// +/// These tests verify the conditional encoding/decoding paths where +/// separate coders are used for decoding and encoding operations. +@Suite("ConditionalCoder Tests") +struct ConditionalCoderTests { + + /// A decoder-only coder that prefixes decoded strings. + struct PrefixDecoder: HelperCoder { + let prefix: String + + func decode(from decoder: Decoder) throws -> String { + let container = try decoder.singleValueContainer() + let value = try container.decode(String.self) + return "\(prefix):\(value)" + } + } + + /// An encoder-only coder that suffixes encoded strings. + struct SuffixEncoder: HelperCoder { + let suffix: String + + func decode(from decoder: Decoder) throws -> String { + let container = try decoder.singleValueContainer() + return try container.decode(String.self) + } + + func encode(_ value: String, to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + try container.encode("\(value):\(suffix)") + } + } + + /// Wrapper for decoding tests. + struct DecodingWrapper: Decodable { + let value: String? + let coder: ConditionalCoder + + enum CodingKeys: String, CodingKey { + case value + } + + init(from decoder: Decoder) throws { + self.coder = ConditionalCoder( + decoder: PrefixDecoder(prefix: "decoded"), + encoder: SuffixEncoder(suffix: "encoded") + ) + let container = try decoder.container(keyedBy: CodingKeys.self) + self.value = try coder.decodeIfPresent( + from: container, + forKey: .value + ) + } + } + + /// Wrapper for encoding tests. + struct EncodingWrapper: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = ConditionalCoder( + decoder: PrefixDecoder(prefix: "decoded"), + encoder: SuffixEncoder(suffix: "encoded") + ) + try coder.encodeIfPresent(value, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } + } + + // MARK: - decodeIfPresent Tests + + /// Tests that `decodeIfPresent` uses the decoder coder and returns value. + @Test("decodeIfPresent returns value when data is valid") + func decodeIfPresentReturnsValue() throws { + let json = #"{"value": "test"}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == "decoded:test") + } + + /// Tests that `decodeIfPresent` returns nil when value is null. + @Test("decodeIfPresent returns nil when value is null") + func decodeIfPresentReturnsNilForNull() throws { + let json = #"{"value": null}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == nil) + } + + /// Tests that `decodeIfPresent` returns nil when key is missing. + @Test("decodeIfPresent returns nil when key is missing") + func decodeIfPresentReturnsNilForMissingKey() throws { + let json = #"{}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == nil) + } + + // MARK: - encodeIfPresent Tests + + /// Tests that `encodeIfPresent` uses the encoder coder when value is present. + @Test("encodeIfPresent encodes when value is present") + func encodeIfPresentEncodesValue() throws { + let wrapper = EncodingWrapper(value: "test") + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json.contains("test:encoded")) + } + + /// Tests that `encodeIfPresent` skips encoding when value is nil. + @Test("encodeIfPresent skips encoding when value is nil") + func encodeIfPresentSkipsNil() throws { + let wrapper = EncodingWrapper(value: nil) + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json == "{}") + } +} diff --git a/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift new file mode 100644 index 0000000000..77e7061c0c --- /dev/null +++ b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift @@ -0,0 +1,177 @@ +import Foundation +import MetaCodable +import Testing + +@testable import HelperCoders + +/// Tests for `DefaultSequenceElementCoding` helper coder. +/// +/// These tests verify the optional encoding/decoding paths for the default +/// sequence element coding implementation used in sequence coders. +@Suite("DefaultSequenceElementCoding Tests") +struct DefaultSequenceElementCodingTests { + + /// Wrapper for decoding tests with keyed container. + struct DecodingWrapper: Decodable { + let value: String? + + enum CodingKeys: String, CodingKey { + case value + } + + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let coder = DefaultSequenceElementCoding() + self.value = try coder.decodeIfPresent(from: container, forKey: .value) + } + } + + /// Wrapper for encoding tests with keyed container. + struct EncodingWrapper: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = DefaultSequenceElementCoding() + try coder.encodeIfPresent(value, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } + } + + // MARK: - decodeIfPresent(from:) Tests + + /// Tests that `decodeIfPresent(from:)` returns value from single value container. + @Test("decodeIfPresent from decoder returns value when present") + func decodeIfPresentFromDecoderReturnsValue() throws { + let json = #""test""# + let data = json.data(using: .utf8)! + + struct SingleValueWrapper: Decodable { + let value: String? + + init(from decoder: Decoder) throws { + let coder = DefaultSequenceElementCoding() + self.value = try coder.decodeIfPresent(from: decoder) + } + } + + let result = try JSONDecoder().decode(SingleValueWrapper.self, from: data) + #expect(result.value == "test") + } + + /// Tests that `decodeIfPresent(from:)` returns nil for null. + @Test("decodeIfPresent from decoder returns nil for null") + func decodeIfPresentFromDecoderReturnsNilForNull() throws { + let json = #"null"# + let data = json.data(using: .utf8)! + + struct SingleValueWrapper: Decodable { + let value: String? + + init(from decoder: Decoder) throws { + let coder = DefaultSequenceElementCoding() + self.value = try coder.decodeIfPresent(from: decoder) + } + } + + let result = try JSONDecoder().decode(SingleValueWrapper.self, from: data) + #expect(result.value == nil) + } + + // MARK: - decodeIfPresent(from:forKey:) Tests + + /// Tests that `decodeIfPresent(from:forKey:)` returns value when present. + @Test("decodeIfPresent from keyed container returns value") + func decodeIfPresentFromKeyedContainerReturnsValue() throws { + let json = #"{"value": "test"}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == "test") + } + + /// Tests that `decodeIfPresent(from:forKey:)` returns nil for null. + @Test("decodeIfPresent from keyed container returns nil for null") + func decodeIfPresentFromKeyedContainerReturnsNilForNull() throws { + let json = #"{"value": null}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == nil) + } + + /// Tests that `decodeIfPresent(from:forKey:)` returns nil for missing key. + @Test("decodeIfPresent from keyed container returns nil for missing key") + func decodeIfPresentFromKeyedContainerReturnsNilForMissingKey() throws { + let json = #"{}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == nil) + } + + // MARK: - encodeIfPresent(_:to:) Tests + + /// Tests that `encodeIfPresent(_:to:)` encodes value when present. + @Test("encodeIfPresent to encoder encodes value when present") + func encodeIfPresentToEncoderEncodesValue() throws { + struct SingleValueWrapper: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + let coder = DefaultSequenceElementCoding() + try coder.encodeIfPresent(value, to: encoder) + } + } + + let wrapper = SingleValueWrapper(value: "test") + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json == #""test""#) + } + + /// Tests that `encodeIfPresent(_:to:)` encodes null for nil. + @Test("encodeIfPresent to encoder encodes null for nil") + func encodeIfPresentToEncoderEncodesNullForNil() throws { + struct SingleValueWrapper: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + let coder = DefaultSequenceElementCoding() + try coder.encodeIfPresent(value, to: encoder) + } + } + + let wrapper = SingleValueWrapper(value: nil) + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json == "null") + } + + // MARK: - encodeIfPresent(_:to:atKey:) Tests + + /// Tests that `encodeIfPresent(_:to:atKey:)` encodes value when present. + @Test("encodeIfPresent to keyed container encodes value when present") + func encodeIfPresentToKeyedContainerEncodesValue() throws { + let wrapper = EncodingWrapper(value: "test") + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json.contains("test")) + } + + /// Tests that `encodeIfPresent(_:to:atKey:)` skips encoding for nil. + @Test("encodeIfPresent to keyed container skips encoding for nil") + func encodeIfPresentToKeyedContainerSkipsNil() throws { + let wrapper = EncodingWrapper(value: nil) + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json == "{}") + } +} diff --git a/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift new file mode 100644 index 0000000000..034f41e625 --- /dev/null +++ b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift @@ -0,0 +1,111 @@ +import Foundation +import MetaCodable +import Testing + +/// Tests for `DynamicCodableIdentifier` CodingKey conformance. +/// +/// These tests verify the CodingKey protocol implementation for +/// DynamicCodableIdentifier, including integer and string initialization. +@Suite("DynamicCodableIdentifier CodingKey Tests") +struct DynamicCodableIdentifierTests { + + // MARK: - init(intValue:) Tests + + /// Tests that `init(intValue:)` always returns nil. + /// + /// DynamicCodableIdentifier uses string-based keys only, + /// so integer initialization is not supported. + @Test("init(intValue:) returns nil") + func initIntValueReturnsNil() { + let identifier = DynamicCodableIdentifier(intValue: 0) + #expect(identifier == nil) + + let identifier2 = DynamicCodableIdentifier(intValue: 42) + #expect(identifier2 == nil) + + let identifier3 = DynamicCodableIdentifier(intValue: -1) + #expect(identifier3 == nil) + } + + /// Tests that `intValue` property always returns nil. + @Test("intValue property returns nil") + func intValuePropertyReturnsNil() { + let identifier: DynamicCodableIdentifier = .one("test") + #expect(identifier.intValue == nil) + + let multiIdentifier: DynamicCodableIdentifier = .many(["a", "b"]) + #expect(multiIdentifier.intValue == nil) + } + + // MARK: - init(stringValue:) Tests + + /// Tests that `init(stringValue:)` creates a single identifier. + @Test("init(stringValue:) creates single identifier") + func initStringValueCreatesSingleIdentifier() { + let identifier = DynamicCodableIdentifier(stringValue: "test") + #expect(identifier != nil) + #expect(identifier?.stringValue == "test") + } + + // MARK: - stringValue Tests + + /// Tests that `stringValue` returns the value for single identifier. + @Test("stringValue returns value for single identifier") + func stringValueReturnsSingleValue() { + let identifier: DynamicCodableIdentifier = .one("myKey") + #expect(identifier.stringValue == "myKey") + } + + /// Tests that `stringValue` returns first value for multiple identifiers. + @Test("stringValue returns first value for multiple identifiers") + func stringValueReturnsFirstValue() { + let identifier: DynamicCodableIdentifier = .many(["first", "second", "third"]) + #expect(identifier.stringValue == "first") + } + + /// Tests that `stringValue` returns empty string for empty multiple identifiers. + @Test("stringValue returns empty string for empty array") + func stringValueReturnsEmptyForEmptyArray() { + let identifier: DynamicCodableIdentifier = .many([]) + #expect(identifier.stringValue == "") + } + + // MARK: - Pattern Matching Tests + + /// Tests pattern matching with single identifier. + @Test("pattern matching works with single identifier") + func patternMatchingSingleIdentifier() { + let identifier: DynamicCodableIdentifier = .one("type") + + struct TestKey: CodingKey { + var stringValue: String + var intValue: Int? { nil } + init?(stringValue: String) { self.stringValue = stringValue } + init?(intValue: Int) { nil } + } + + let key = TestKey(stringValue: "type")! + #expect(identifier ~= key) + + let otherKey = TestKey(stringValue: "other")! + #expect(!(identifier ~= otherKey)) + } + + /// Tests pattern matching with multiple identifiers. + @Test("pattern matching works with multiple identifiers") + func patternMatchingMultipleIdentifiers() { + let identifier: DynamicCodableIdentifier = .many(["type", "kind", "category"]) + + struct TestKey: CodingKey { + var stringValue: String + var intValue: Int? { nil } + init?(stringValue: String) { self.stringValue = stringValue } + init?(intValue: Int) { nil } + } + + #expect(identifier ~= TestKey(stringValue: "type")!) + #expect(identifier ~= TestKey(stringValue: "kind")!) + #expect(identifier ~= TestKey(stringValue: "category")!) + #expect(!(identifier ~= TestKey(stringValue: "other")!)) + } +} diff --git a/Tests/MetaCodableTests/HelperCoderTests.swift b/Tests/MetaCodableTests/HelperCoderTests.swift new file mode 100644 index 0000000000..2520900fec --- /dev/null +++ b/Tests/MetaCodableTests/HelperCoderTests.swift @@ -0,0 +1,226 @@ +import Foundation +import MetaCodable +import Testing + +/// Tests for `HelperCoder` protocol default implementations. +/// +/// These tests verify the optional encoding/decoding paths that have +/// default implementations in the `HelperCoder` protocol extension. +@Suite("HelperCoder Protocol Tests") +struct HelperCoderTests { + + /// A simple helper coder for testing that wraps String values. + struct StringWrapperCoder: HelperCoder { + func decode(from decoder: Decoder) throws -> String { + let container = try decoder.singleValueContainer() + let value = try container.decode(String.self) + return "wrapped:\(value)" + } + } + + /// A helper coder for non-Encodable types to test the default encode path. + struct NonEncodableValue { + let value: Int + } + + struct NonEncodableCoder: HelperCoder { + func decode(from decoder: Decoder) throws -> NonEncodableValue { + let container = try decoder.singleValueContainer() + let value = try container.decode(Int.self) + return NonEncodableValue(value: value) + } + } + + // MARK: - decodeIfPresent Tests + + /// Tests that `decodeIfPresent` returns a value when valid data is present. + @Test("decodeIfPresent returns value when data is valid") + func decodeIfPresentWithValidData() throws { + let json = #"{"value": "test"}"# + let data = json.data(using: .utf8)! + let decoder = JSONDecoder() + + struct Container: Decodable { + let value: String + + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + self.value = try coder.decodeIfPresent( + from: container, + forKey: .value + ) ?? "default" + } + + enum CodingKeys: String, CodingKey { + case value + } + } + + let result = try decoder.decode(Container.self, from: data) + #expect(result.value == "wrapped:test") + } + + /// Tests that `decodeIfPresent` returns nil when data is null. + @Test("decodeIfPresent returns nil when data is null") + func decodeIfPresentWithNullData() throws { + let json = #"{"value": null}"# + let data = json.data(using: .utf8)! + let decoder = JSONDecoder() + + struct Container: Decodable { + let value: String? + + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + self.value = try coder.decodeIfPresent( + from: container, + forKey: .value + ) + } + + enum CodingKeys: String, CodingKey { + case value + } + } + + let result = try decoder.decode(Container.self, from: data) + #expect(result.value == nil) + } + + /// Tests that `decodeIfPresent` returns nil when key is missing. + @Test("decodeIfPresent returns nil when key is missing") + func decodeIfPresentWithMissingKey() throws { + let json = #"{}"# + let data = json.data(using: .utf8)! + let decoder = JSONDecoder() + + struct Container: Decodable { + let value: String? + + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + self.value = try coder.decodeIfPresent( + from: container, + forKey: .value + ) + } + + enum CodingKeys: String, CodingKey { + case value + } + } + + let result = try decoder.decode(Container.self, from: data) + #expect(result.value == nil) + } + + // MARK: - encode Tests + + /// Tests that `encode` works for Encodable types. + @Test("encode works for Encodable types") + func encodeEncodableType() throws { + struct Container: Encodable { + let value: String + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + try coder.encode(value, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } + } + + let container = Container(value: "test") + let encoder = JSONEncoder() + let data = try encoder.encode(container) + let json = String(data: data, encoding: .utf8)! + + #expect(json.contains("test")) + } + + /// Tests that `encode` does nothing for non-Encodable types (default implementation). + @Test("encode does nothing for non-Encodable types") + func encodeNonEncodableType() throws { + struct Container: Encodable { + let nonEncodable: NonEncodableValue + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = NonEncodableCoder() + // This should not throw, just do nothing + try coder.encode(nonEncodable, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } + } + + let container = Container(nonEncodable: NonEncodableValue(value: 42)) + let encoder = JSONEncoder() + let data = try encoder.encode(container) + let json = String(data: data, encoding: .utf8)! + + // The non-encodable value should not appear in the output + #expect(!json.contains("42")) + } + + // MARK: - encodeIfPresent Tests + + /// Tests that `encodeIfPresent` encodes when value is present. + @Test("encodeIfPresent encodes when value is present") + func encodeIfPresentWithValue() throws { + struct Container: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + try coder.encodeIfPresent(value, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } + } + + let container = Container(value: "test") + let encoder = JSONEncoder() + let data = try encoder.encode(container) + let json = String(data: data, encoding: .utf8)! + + #expect(json.contains("test")) + } + + /// Tests that `encodeIfPresent` skips encoding when value is nil. + @Test("encodeIfPresent skips encoding when value is nil") + func encodeIfPresentWithNil() throws { + struct Container: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + try coder.encodeIfPresent(value, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } + } + + let container = Container(value: nil) + let encoder = JSONEncoder() + let data = try encoder.encode(container) + let json = String(data: data, encoding: .utf8)! + + // Should be empty object since nil values are skipped + #expect(json == "{}") + } +} diff --git a/Tests/TODO/CoverageTracking.md b/Tests/TODO/CoverageTracking.md new file mode 100644 index 0000000000..ba616dee19 --- /dev/null +++ b/Tests/TODO/CoverageTracking.md @@ -0,0 +1,218 @@ +# Test Coverage Tracking + +This document tracks functions with less than 100% test coverage and their testing status. + +## Legend + +- ✅ Test created - link to test file provided +- ⏭️ Skipped - reason provided +- 🔄 In progress + +--- + +## MetaCodable Module (20.2% coverage, 341 lines) + +### AnyCodableLiteral.swift (0.0% coverage, 210 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `init()` | 0.0% | ⏭️ | Internal protocol conformance, exercised indirectly through DynamicCodable | +| `init(booleanLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol, tested via literal usage | +| `init(integerLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol, tested via literal usage | +| `init(floatLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol, tested via literal usage | +| `init(stringLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol, tested via literal usage | +| `init(extendedGraphemeClusterLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol, tested via literal usage | +| `init(unicodeScalarLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol, tested via literal usage | +| `hash(into:)` | 0.0% | ⏭️ | Hashable conformance, used in collections | +| `==` operator | 0.0% | ⏭️ | Equatable conformance | +| `<` operator | 0.0% | ⏭️ | Comparable conformance | +| `description` getter | 0.0% | ⏭️ | CustomStringConvertible | +| `debugDescription` getter | 0.0% | ⏭️ | CustomDebugStringConvertible | +| Numeric operators (+, -, *, /) | 0.0% | ⏭️ | Numeric protocol conformance, rarely used directly | +| Range operators | 0.0% | ⏭️ | Used for range-based CodedAs values | + +**Decision**: Skip direct testing. `AnyCodableLiteral` is an internal type used for macro processing. Its functionality is exercised through higher-level tests like `CodedAsTests.WithAnyCodableLiteralEnum`. + +### CodableCommonStrategy.swift (0.0% coverage, 1 line) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `init()` | 0.0% | ⏭️ | Empty initializer for strategy protocol | + +**Decision**: Skip. Protocol requirement with no implementation logic. + +### DynamicCodableIdentifier+CodingKey.swift (22.2% coverage, 36 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `description` getter | 0.0% | ⏭️ | Debug utility | +| `debugDescription` getter | 0.0% | ⏭️ | Debug utility | +| `intValue` getter | 0.0% | ⏭️ | CodingKey conformance | +| `stringValue` getter | 87.5% | ⏭️ | Nearly full coverage | +| `init(intValue:)` | 0.0% | ✅ | Tested in [DynamicCodableIdentifierTests.swift](../MetaCodableTests/DynamicCodableIdentifierTests.swift) | +| `init(stringValue:)` | 100.0% | ✅ | Already covered | + +### DynamicCodableIdentifier+Expressible.swift (42.9% coverage, 21 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `init(unicodeScalarLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol | +| `init(extendedGraphemeClusterLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol | +| `init(integerLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol | +| `init(floatLiteral:)` | 0.0% | ⏭️ | ExpressibleBy protocol | +| `init(stringLiteral:)` | 100.0% | ✅ | Already covered | +| `init(arrayLiteral:)` | 100.0% | ✅ | Already covered | +| `init(nilLiteral:)` | 100.0% | ✅ | Already covered | + +### DynamicCodableIdentifier.swift (62.1% coverage, 29 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `encode(to:)` | 0.0% | 🔄 | Important - encoding DynamicCodable values | + +--- + +## HelperCoders Module (90.7% coverage, 462 lines) + +### HelperCoder.swift (64.3% coverage, 28 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `decodeIfPresent(from:)` | 0.0% | ✅ | Tested in [HelperCoderTests.swift](../MetaCodableTests/HelperCoderTests.swift) | +| `encode(_:to:)` | 0.0% | ✅ | Tested in [HelperCoderTests.swift](../MetaCodableTests/HelperCoderTests.swift) | +| `encodeIfPresent(_:to:)` | 0.0% | ✅ | Tested in [HelperCoderTests.swift](../MetaCodableTests/HelperCoderTests.swift) | + +### HelperCoderStrategy.swift (0.0% coverage, 3 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `static codedBy(_:)` | 0.0% | ⏭️ | Strategy factory, exercised through macro usage | + +### DefaultSequenceElementCoding.swift (25.0% coverage, 24 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `decodeIfPresent(from:)` | 0.0% | ✅ | Tested in [DefaultSequenceElementCodingTests.swift](../MetaCodableTests/DefaultSequenceElementCodingTests.swift) | +| `decode(from:forKey:)` | 0.0% | ⏭️ | Keyed decoding variant | +| `decodeIfPresent(from:forKey:)` | 0.0% | ✅ | Tested in [DefaultSequenceElementCodingTests.swift](../MetaCodableTests/DefaultSequenceElementCodingTests.swift) | +| `encodeIfPresent(_:to:)` | 0.0% | ✅ | Tested in [DefaultSequenceElementCodingTests.swift](../MetaCodableTests/DefaultSequenceElementCodingTests.swift) | +| `encode(_:to:atKey:)` | 0.0% | ⏭️ | Keyed encoding variant | +| `encodeIfPresent(_:to:atKey:)` | 0.0% | ✅ | Tested in [DefaultSequenceElementCodingTests.swift](../MetaCodableTests/DefaultSequenceElementCodingTests.swift) | +| `decode(from:)` | 100.0% | ✅ | Already covered | +| `encode(_:to:)` | 100.0% | ✅ | Already covered | + +### ConditionalCoder.swift (62.5% coverage, 16 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `decodeIfPresent(from:)` | 0.0% | ✅ | Tested in [ConditionalCoderTests.swift](../MetaCodableTests/ConditionalCoderTests.swift) | +| `encodeIfPresent(_:to:)` | 0.0% | ✅ | Tested in [ConditionalCoderTests.swift](../MetaCodableTests/ConditionalCoderTests.swift) | +| `init(decoder:encoder:)` | 100.0% | ✅ | Already covered | +| `decode(from:)` | 100.0% | ✅ | Already covered | +| `encode(_:to:)` | 100.0% | ✅ | Already covered | + +### SequenceCoderConfiguration.swift (86.2% coverage, 80 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `formSymmetricDifference(_:)` | 0.0% | ⏭️ | OptionSet conformance, rarely used directly | +| `formIntersection(_:)` | 89.5% | ⏭️ | Nearly full coverage | + +### SequenceCoder.swift (93.8% coverage, 81 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `init(elementHelper:configuration:)` | 0.0% | ⏭️ | Convenience initializer, other inits cover functionality | + +--- + +## PluginCore Module + +### Definitions.swift (85.3% coverage, 136 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `static Codable.expansion(of:providingMembersOf:in:)` | 0.0% | ⏭️ | Macro entry point, tested through expansion tests | +| `static MemberInit.expansion(of:providingMembersOf:in:)` | 0.0% | ⏭️ | Macro entry point | +| `static ConformDecodable.expansion(of:providingMembersOf:in:)` | 0.0% | ⏭️ | Macro entry point | +| `static ConformEncodable.expansion(of:providingMembersOf:in:)` | 0.0% | ⏭️ | Macro entry point | + +### Decodable+Expansion.swift (64.0% coverage, 50 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| Closures in `expansion` methods | 0.0% | ⏭️ | Internal closures, exercised through macro tests | +| `expansion(of:providingMembersOf:conformingTo:in:)` | 58.8% | ⏭️ | Partial coverage acceptable | + +### Encodable+Expansion.swift (64.0% coverage, 50 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| Closures in `expansion` methods | 0.0% | ⏭️ | Internal closures, exercised through macro tests | +| `expansion(of:providingMembersOf:conformingTo:in:)` | 58.8% | ⏭️ | Partial coverage acceptable | + +### UnTaggedEnumSwitcher.swift (86.8% coverage, 205 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `ThrowingSyntaxVisitor.visit(_:)` | 0.0% | ⏭️ | Error handling path | +| `ErrorUsageSyntaxVisitor.visit(_:)` | 0.0% | ⏭️ | Error handling path | +| `keyExpression` closure | 0.0% | ⏭️ | Internal closure | + +### ActorVariable.swift (83.9% coverage, 62 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| Closures in `decoding` | 0.0% | ⏭️ | Internal async handling | + +### AdjacentlyTaggedEnumSwitcher.swift (85.2% coverage, 61 lines) + +| Function | Coverage | Status | Notes | +|----------|----------|--------|-------| +| `CoderVariable.requireDecodable` getter | 0.0% | ⏭️ | Rare path | +| `CoderVariable.requireEncodable` getter | 0.0% | ⏭️ | Rare path | +| `decoding/encoding` methods | 87.5% | ⏭️ | Nearly full coverage | + +--- + +## Test Files with Low Coverage + +These are test helper types that don't need direct testing: + +- `CodableTests.swift` - Test helper structs (SomeCodable types) at 0.0% are expected +- `CodedByActionTests.swift` - Test helper types at 0.0% are expected +- `VariableDeclarationTests.swift` - Test helper types at 0.0% are expected + +--- + +## Priority Tests to Implement + +### High Priority (widely used, 0% coverage) + +1. **HelperCoder optional methods** - `decodeIfPresent`, `encode`, `encodeIfPresent` +2. **ConditionalCoder optional methods** - `decodeIfPresent`, `encodeIfPresent` +3. **DynamicCodableIdentifier.encode(to:)** - Encoding dynamic values + +### Medium Priority + +4. **DefaultSequenceElementCoding optional methods** +5. **DynamicCodableIdentifier+CodingKey.init(intValue:)** + +### Low Priority (skip with reason) + +- AnyCodableLiteral methods - Internal type, tested indirectly +- ExpressibleBy protocol methods - Standard Swift protocol conformance +- Macro entry points - Tested through expansion tests +- OptionSet methods - Standard Swift conformance + +--- + +## Tests Created + +| Test File | Functions Covered | Date | +|-----------|-------------------|------| +| [HelperCoderTests.swift](../MetaCodableTests/HelperCoderTests.swift) | `HelperCoder.decodeIfPresent`, `encode`, `encodeIfPresent` | 2026-01-30 | +| [ConditionalCoderTests.swift](../MetaCodableTests/ConditionalCoderTests.swift) | `ConditionalCoder.decodeIfPresent`, `encodeIfPresent` | 2026-01-30 | +| [DefaultSequenceElementCodingTests.swift](../MetaCodableTests/DefaultSequenceElementCodingTests.swift) | `DefaultSequenceElementCoding` optional methods | 2026-01-30 | +| [DynamicCodableIdentifierTests.swift](../MetaCodableTests/DynamicCodableIdentifierTests.swift) | `DynamicCodableIdentifier` CodingKey methods | 2026-01-30 | + From 3873f76228d15d63a156292767ad0ff32d3902dc Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 15:05:46 +0700 Subject: [PATCH 13/29] Merge branch 'merge/upstream' --- .gitignore | 1 + CHANGELOG.md | 1 + Package.swift | 1 + Package@swift-5.swift | 1 + .../Switcher/TaggedEnumSwitcherVariable.swift | 6 +++-- .../Variables/Type/EnumVariable.swift | 22 +++++++++++-------- .../CodedAs/CodedAsTests.swift | 2 -- .../ConformCodableTests.swift | 1 + 8 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 8360953a99..e54808a55b 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ Package.resolved *.o *.d *.swiftdeps* +*.dia # CocoaPods # diff --git a/CHANGELOG.md b/CHANGELOG.md index fcf058a2a8..935b8ba2ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### 🐛 Fixes * fixed optional types not detected with `valueCoder` strategy ([#141](https://github.com/SwiftyLab/MetaCodable/issues/141)) ([5873c3e](https://github.com/SwiftyLab/MetaCodable/commit/5873c3e33ab98e61c06304bfc2a2c93ab199d65d)) +* removed unreachable `default` case warnings for `Bool` type switches in macro-generated code ## [1.5.0](https://github.com/SwiftyLab/MetaCodable/compare/v1.4.0...v1.5.0) (2025-07-08) diff --git a/Package.swift b/Package.swift index 1ae5615a85..f4f03f2d5b 100644 --- a/Package.swift +++ b/Package.swift @@ -35,6 +35,7 @@ let package = Package( .product(name: "SwiftDiagnostics", package: "swift-syntax"), .product(name: "SwiftSyntaxBuilder", package: "swift-syntax"), .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), + .product(name: "SwiftSyntaxMacroExpansion", package: "swift-syntax"), .product(name: "OrderedCollections", package: "swift-collections"), ] ), diff --git a/Package@swift-5.swift b/Package@swift-5.swift index 0c9e959d94..7d82f6fa76 100644 --- a/Package@swift-5.swift +++ b/Package@swift-5.swift @@ -34,6 +34,7 @@ let package = Package( .product(name: "SwiftDiagnostics", package: "swift-syntax"), .product(name: "SwiftSyntaxBuilder", package: "swift-syntax"), .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), + .product(name: "SwiftSyntaxMacroExpansion", package: "swift-syntax"), .product(name: "OrderedCollections", package: "swift-collections"), ] ), diff --git a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift index 4d8d33f600..3f4cea9b6a 100644 --- a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift +++ b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift @@ -21,7 +21,9 @@ extension TaggedEnumSwitcherVariable { /// - location: The decoding location. /// - coder: The decoder for cases. /// - context: The context in which to perform the macro expansion. - /// - default: Whether default case is needed. + /// - default: Whether default case is needed. Note that for Bool type, + /// the default case is automatically skipped since both true and false + /// cases are explicitly handled, avoiding unreachable default warnings. /// - forceDecodingReturn: Whether to force explicit `return` statements in each /// switch case. When `true`, adds a `return` statement after the case assignment /// for early exit. Defaults to `false` for backward compatibility. @@ -60,7 +62,7 @@ extension TaggedEnumSwitcherVariable { } } - if `default` { + if `default` && header.type != .bool { SwitchCaseSyntax(label: .default(.init())) { "break" } diff --git a/Sources/PluginCore/Variables/Type/EnumVariable.swift b/Sources/PluginCore/Variables/Type/EnumVariable.swift index 780dde41f2..af3b6bee7c 100644 --- a/Sources/PluginCore/Variables/Type/EnumVariable.swift +++ b/Sources/PluginCore/Variables/Type/EnumVariable.swift @@ -84,15 +84,19 @@ package struct EnumVariable: TypeVariable, DeclaredVariable { let caseEncodeExpr: CaseCode = { name, variables in let args = Self.encodingArgs(representing: variables) let callee: ExprSyntax = ".\(name)" - let fExpr = - if !args.isEmpty { - FunctionCallExprSyntax(callee: callee) { args } - } else { - FunctionCallExprSyntax( - calledExpression: callee, leftParen: nil, rightParen: nil - ) {} - } - return ExprSyntax(fExpr) + if args.isEmpty { + /// No associated values: return just the case name without parentheses + return callee + } else { + let fExpr = FunctionCallExprSyntax( + calledExpression: callee, + leftParen: .leftParenToken(), + arguments: args, + rightParen: .rightParenToken(), + trailingClosure: nil + ) + return ExprSyntax(fExpr) + } } self.init( from: decl, in: context, diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift index 259ff10b44..c29de92d8f 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift @@ -332,8 +332,6 @@ struct CodedAsTests { value = try container.decode(Int.self, forKey: CodingKeys.value) self = .store(key: key, value: value) return - default: - break } } let typeInt: Int? diff --git a/Tests/MetaCodableTests/ConformCodableTests.swift b/Tests/MetaCodableTests/ConformCodableTests.swift index c68962be8e..d8cd483a91 100644 --- a/Tests/MetaCodableTests/ConformCodableTests.swift +++ b/Tests/MetaCodableTests/ConformCodableTests.swift @@ -464,3 +464,4 @@ struct ConformDecodableTests { } } } + From 2d447309730576f356a806a67163b56277498b44 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 15:14:48 +0700 Subject: [PATCH 14/29] test: add @Suite declarations and meaningful test names to all test files Updated 50 test files to: - Add @Suite declarations for logical grouping of tests - Replace unnamed @Test() with @Test("descriptive name") - Group related tests into nested suites where appropriate - Improve test organization and readability All tests continue to pass after the updates. --- .../AccessModifierTests.swift | 19 +++-- .../Attributes/CodedByTests.swift | 7 +- .../Attributes/DefaultTests.swift | 14 ++-- .../CommonStrategiesValueCoderTests.swift | 30 +++++--- .../CodableInheritanceTests.swift | 22 +++--- Tests/MetaCodableTests/CodableTests.swift | 40 ++++++---- .../CodedAs/CodedAsEnumTests.swift | 20 +++-- .../CodedAs/CodedAsTests.swift | 76 ++++++++++--------- .../CodedAt/CodedAtDefaultChoiceTests.swift | 37 ++++++--- .../CodedAtDefaultOnlyMissingTests.swift | 37 ++++++--- .../CodedAt/CodedAtDefaultTests.swift | 37 ++++++--- .../CodedAt/CodedAtEnumTests.swift | 17 +++-- .../CodedAt/CodedAtHelperDefaultTests.swift | 28 ++++--- .../CodedAt/CodedAtHelperTests.swift | 34 ++++++--- .../CodedAt/CodedAtTests.swift | 62 +++++++++------ .../CodedAt/DecodedAtTests.swift | 43 +++++++---- .../CodedAt/EncodedAtTests.swift | 43 +++++++---- .../CodedBy/CodedByActionTests.swift | 26 ++++--- .../CodedIn/CodedInDefaultTests.swift | 34 ++++++--- .../CodedInHelperDefaultChoiceTests.swift | 28 ++++--- ...CodedInHelperDefaultOnlyMissingTests.swift | 28 ++++--- .../CodedIn/CodedInHelperDefaultTests.swift | 28 ++++--- .../CodedIn/CodedInHelperTests.swift | 28 ++++--- .../CodedIn/CodedInTests.swift | 46 ++++++----- .../CodingKeysGenerationTests.swift | 21 +++-- Tests/MetaCodableTests/CodingKeysTests.swift | 38 ++++++---- .../ConditionalCoderTests.swift | 2 +- .../ConformCodableTests.swift | 32 +++++--- Tests/MetaCodableTests/ContentAtTests.swift | 18 +++-- .../DecodedAtEncodedAtIntegrationTests.swift | 24 +++--- .../DefaultSequenceElementCodingTests.swift | 2 +- .../DynamicCodable/DynamicCodableTests.swift | 9 ++- .../DynamicCodableIdentifierTests.swift | 2 +- .../ExplicitCodingTests.swift | 28 ++++--- Tests/MetaCodableTests/GenericsTests.swift | 50 +++++++----- .../GroupedMutableVariableTests.swift | 15 ++-- .../GroupedVariableTests.swift | 22 ++++-- Tests/MetaCodableTests/HelperCoderTests.swift | 2 +- .../HelperCoders/DataCoderTests.swift | 5 +- .../HelperCoders/DateCoderTests.swift | 5 +- .../HelperCoders/HelperCodersTests.swift | 5 +- .../HelperCoders/LossySequenceTests.swift | 37 ++++++--- .../NonConformingCoderTests.swift | 13 ++-- .../HelperCoders/SequenceCoderTests.swift | 33 ++++---- .../HelperCoders/ValueCoderTests.swift | 25 +++--- .../MetaCodableTests/IgnoreCodingTests.swift | 70 ++++++++++------- .../IgnoreInitializedTests.swift | 24 ++++-- .../RawRepresentableEnumTests.swift | 22 ++++-- .../MetaCodableTests/UntaggedEnumTests.swift | 26 ++++--- .../VariableDeclarationTests.swift | 37 +++++---- 50 files changed, 847 insertions(+), 504 deletions(-) diff --git a/Tests/MetaCodableTests/AccessModifierTests.swift b/Tests/MetaCodableTests/AccessModifierTests.swift index bcc39570fe..dd41ac8323 100644 --- a/Tests/MetaCodableTests/AccessModifierTests.swift +++ b/Tests/MetaCodableTests/AccessModifierTests.swift @@ -4,14 +4,16 @@ import Testing @testable import PluginCore +@Suite("Access Modifier Tests") struct AccessModifierTests { + @Suite("Access Modifier - Open") struct Open { @Codable open class SomeCodable { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -49,7 +51,7 @@ struct AccessModifierTests { ) } - @Test + @Test("open Class Decoding Only") func openClassDecodingOnly() throws { // Open class doesn't have memberwise init, only decoder init let jsonStr = """ @@ -63,7 +65,7 @@ struct AccessModifierTests { #expect(decoded.value == "open_test") } - @Test + @Test("open Class From J S O N") func openClassFromJSON() throws { let jsonStr = """ { @@ -77,6 +79,7 @@ struct AccessModifierTests { } } + @Suite("Access Modifier - Public") struct Public { @Codable @MemberInit @@ -84,7 +87,7 @@ struct AccessModifierTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -127,7 +130,7 @@ struct AccessModifierTests { ) } - @Test + @Test("public Struct Decoding And Encoding") func publicStructDecodingAndEncoding() throws { let original = SomeCodable(value: "public_test") let encoded = try JSONEncoder().encode(original) @@ -136,7 +139,7 @@ struct AccessModifierTests { #expect(decoded.value == "public_test") } - @Test + @Test("public Struct From J S O N") func publicStructFromJSON() throws { let jsonStr = """ { @@ -150,6 +153,7 @@ struct AccessModifierTests { } } + @Suite("Access Modifier - Package") struct Package { @Codable @MemberInit @@ -157,7 +161,7 @@ struct AccessModifierTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -201,6 +205,7 @@ struct AccessModifierTests { } } + @Suite("Access Modifier - Others") struct Others { struct Internal { @Codable diff --git a/Tests/MetaCodableTests/Attributes/CodedByTests.swift b/Tests/MetaCodableTests/Attributes/CodedByTests.swift index d746eb2c41..5802a80ccf 100644 --- a/Tests/MetaCodableTests/Attributes/CodedByTests.swift +++ b/Tests/MetaCodableTests/Attributes/CodedByTests.swift @@ -2,8 +2,9 @@ import Testing @testable import PluginCore +@Suite("Coded By Tests") struct CodedByTests { - @Test + @Test("misuse On Non Variable Declaration") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -34,7 +35,7 @@ struct CodedByTests { ) } - @Test + @Test("misuse On Static Variable") func misuseOnStaticVariable() throws { assertMacroExpansion( """ @@ -63,7 +64,7 @@ struct CodedByTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/Attributes/DefaultTests.swift b/Tests/MetaCodableTests/Attributes/DefaultTests.swift index 3cc348a324..2fc45f8157 100644 --- a/Tests/MetaCodableTests/Attributes/DefaultTests.swift +++ b/Tests/MetaCodableTests/Attributes/DefaultTests.swift @@ -4,8 +4,9 @@ import Testing @testable import PluginCore +@Suite("Default Tests") struct DefaultTests { - @Test + @Test("misuse On Non Variable Declaration") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -36,7 +37,7 @@ struct DefaultTests { ) } - @Test + @Test("misuse On Static Variable") func misuseOnStaticVariable() throws { assertMacroExpansion( """ @@ -65,7 +66,7 @@ struct DefaultTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -104,6 +105,7 @@ struct DefaultTests { ) } + @Suite("Default - Default Value Behavior") struct DefaultValueBehavior { @Codable struct SomeCodable { @@ -113,7 +115,7 @@ struct DefaultTests { let number: Int } - @Test + @Test("default Value Usage") func defaultValueUsage() throws { // Test with missing keys in JSON let jsonStr = "{}" @@ -124,7 +126,7 @@ struct DefaultTests { #expect(decoded.number == 42) } - @Test + @Test("override Default Values") func overrideDefaultValues() throws { // Test with provided values in JSON let jsonStr = """ @@ -140,7 +142,7 @@ struct DefaultTests { #expect(decoded.number == 100) } - @Test + @Test("encoding With Defaults") func encodingWithDefaults() throws { let original = SomeCodable(value: "test", number: 99) let encoded = try JSONEncoder().encode(original) diff --git a/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift b/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift index 14e8df7948..3365a0796c 100644 --- a/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift +++ b/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift @@ -4,6 +4,7 @@ import MetaCodable import Testing // Test for @Codable(commonStrategies: [.codedBy(.valueCoder())]) +@Suite("Common Strategies Value Coder Tests") struct CommonStrategiesValueCoderTests { @Codable(commonStrategies: [.codedBy(.valueCoder())]) struct Model { @@ -25,7 +26,7 @@ struct CommonStrategiesValueCoderTests { let optGenString: String? } - @Test + @Test("test Parsing") func testParsing() throws { let json = """ { @@ -56,7 +57,7 @@ struct CommonStrategiesValueCoderTests { #expect(reDecoded.string == "5265762156") } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -170,6 +171,7 @@ struct CommonStrategiesValueCoderTests { } // Test 1: Properties that don't conform to ValueCodingStrategy + @Suite("Common Strategies Value Coder - Non Conforming Types") struct NonConformingTypes { @Codable(commonStrategies: [.codedBy(.valueCoder())]) struct Model { @@ -181,7 +183,7 @@ struct CommonStrategiesValueCoderTests { let identifier: UUID } - @Test + @Test("test Non Conforming Types") func testNonConformingTypes() throws { let json = """ { @@ -216,7 +218,7 @@ struct CommonStrategiesValueCoderTests { ) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -266,6 +268,7 @@ struct CommonStrategiesValueCoderTests { } // Test 2: Custom types conforming to ValueCodingStrategy + @Suite("Common Strategies Value Coder - Custom Strategies") struct CustomStrategies { @Codable(commonStrategies: [.codedBy(.valueCoder([CGFloat.self]))]) struct Model { @@ -277,7 +280,7 @@ struct CommonStrategiesValueCoderTests { let plainText: String } - @Test + @Test("test Custom Strategies") func testCustomStrategies() throws { let json = """ { @@ -308,7 +311,7 @@ struct CommonStrategiesValueCoderTests { ) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -358,6 +361,7 @@ struct CommonStrategiesValueCoderTests { } // Test 3: Empty commonStrategies array + @Suite("Common Strategies Value Coder - Empty Strategies") struct EmptyStrategies { @Codable(commonStrategies: []) struct Model { @@ -367,7 +371,7 @@ struct CommonStrategiesValueCoderTests { let string: String } - @Test + @Test("test Empty Strategies") func testEmptyStrategies() throws { let json = """ { @@ -399,7 +403,7 @@ struct CommonStrategiesValueCoderTests { ) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -454,6 +458,7 @@ struct CommonStrategiesValueCoderTests { } // Test 4: Enum with common strategies + @Suite("Common Strategies Value Coder - Enum") struct EnumTests { @Codable(commonStrategies: [.codedBy(.valueCoder())]) @CodedAt("type") @@ -463,7 +468,7 @@ struct CommonStrategiesValueCoderTests { case pending(until: String) } - @Test + @Test("test Enum With Common Strategies") func testEnumWithCommonStrategies() throws { // Test that associated values can use number-to-string conversion let json = """ @@ -526,7 +531,7 @@ struct CommonStrategiesValueCoderTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -627,6 +632,7 @@ struct CommonStrategiesValueCoderTests { } // Test 5: Overriding helper coder with common strategies + @Suite("Common Strategies Value Coder - Helper Coder Override") struct HelperCoderOverrideTests { @Codable(commonStrategies: [.codedBy(.valueCoder())]) struct ModelWithOverride { @@ -635,7 +641,7 @@ struct CommonStrategiesValueCoderTests { let count: Int } - @Test + @Test("test Helper Coder Override") func testHelperCoderOverride() throws { let json = """ { @@ -662,7 +668,7 @@ struct CommonStrategiesValueCoderTests { #expect(encoded == #"{"count":42,"id":"21"}"#) // CustomIntCoder halves the value for id } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodableInheritanceTests.swift b/Tests/MetaCodableTests/CodableInheritanceTests.swift index 80a381fab5..9cf0d46890 100644 --- a/Tests/MetaCodableTests/CodableInheritanceTests.swift +++ b/Tests/MetaCodableTests/CodableInheritanceTests.swift @@ -4,8 +4,9 @@ import Testing @testable import PluginCore +@Suite("Codable Inheritance Tests") struct CodableInheritanceTests { - @Test + @Test("misuse On Non Class Declaration") func misuseOnNonClassDeclaration() throws { assertMacroExpansion( """ @@ -55,6 +56,7 @@ struct CodableInheritanceTests { ) } + @Suite("Codable Inheritance - No Inheritance") struct NoInheritance { @Codable @Inherits(decodable: false, encodable: false) @@ -64,7 +66,7 @@ struct CodableInheritanceTests { init() {} } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -108,7 +110,7 @@ struct CodableInheritanceTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = SomeCodable() original.value = "inheritance_test" @@ -118,7 +120,7 @@ struct CodableInheritanceTests { #expect(decoded.value == "inheritance_test") } - @Test + @Test("decoding From J S O N") func decodingFromJSON() throws { let jsonStr = """ { @@ -131,7 +133,7 @@ struct CodableInheritanceTests { #expect(decoded.value == "class_value") } - @Test + @Test("encoding To J S O N") func encodingToJSON() throws { let original = SomeCodable() original.value = "encoded_class" @@ -143,6 +145,7 @@ struct CodableInheritanceTests { } } + @Suite("Codable Inheritance - Explicit") struct WithExplicitInheritance { class SuperCodable: Swift.Codable {} @@ -154,7 +157,7 @@ struct CodableInheritanceTests { override init() { super.init() } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -194,7 +197,7 @@ struct CodableInheritanceTests { ) } - @Test + @Test("inheritance Decoding And Encoding") func inheritanceDecodingAndEncoding() throws { let original = SomeCodable() original.value = "inherited_test" @@ -204,7 +207,7 @@ struct CodableInheritanceTests { #expect(decoded.value == "inherited_test") } - @Test + @Test("inheritance From J S O N") func inheritanceFromJSON() throws { let jsonStr = """ { @@ -218,6 +221,7 @@ struct CodableInheritanceTests { } } + @Suite("Codable Inheritance - Explicit") struct WithExplicitPartialInheritance { class SuperDecodable: Decodable {} @@ -229,7 +233,7 @@ struct CodableInheritanceTests { override init() { super.init() } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodableTests.swift b/Tests/MetaCodableTests/CodableTests.swift index b57216cd80..4c3f5f2c03 100644 --- a/Tests/MetaCodableTests/CodableTests.swift +++ b/Tests/MetaCodableTests/CodableTests.swift @@ -14,7 +14,10 @@ import SwiftSyntaxMacrosGenericTestSupport import SwiftSyntaxMacrosTestSupport #endif +@Suite("Codable Tests") struct CodableTests { + + @Suite("Codable - Available Attribute") struct WithoutAvailableAttribute { @Codable @available(*, deprecated, message: "Deprecated") @@ -27,7 +30,7 @@ struct CodableTests { } } - @Test + @Test("expansion generates correct Codable implementation") func expansion() throws { assertMacroExpansion( """ @@ -77,7 +80,7 @@ struct CodableTests { ) } - @Test + @Test("encoding works with available attribute") @available(*, deprecated, message: "Deprecated") func availableAttributeEncoding() throws { let original = SomeCodable(value: "deprecated_test") @@ -87,7 +90,7 @@ struct CodableTests { #expect(decoded.value == "deprecated_test") } - @Test + @Test("decoding from JSON works with available attribute") @available(*, deprecated, message: "Deprecated") func availableAttributeFromJSON() throws { let jsonStr = """ @@ -102,6 +105,8 @@ struct CodableTests { } } + + @Suite("Codable - No Customization") struct WithoutAnyCustomization { @Codable struct SomeCodable { @@ -113,7 +118,7 @@ struct CodableTests { } } - @Test + @Test("expansion generates correct Codable implementation") func expansion() throws { assertMacroExpansion( """ @@ -161,7 +166,7 @@ struct CodableTests { ) } - @Test + @Test("basic Codable encoding works") func basicCodableEncoding() throws { let original = SomeCodable(value: "basic_test") let encoded = try JSONEncoder().encode(original) @@ -170,7 +175,7 @@ struct CodableTests { #expect(decoded.value == "basic_test") } - @Test + @Test("basic Codable decoding from JSON works") func basicCodableFromJSON() throws { let jsonStr = """ { @@ -183,7 +188,7 @@ struct CodableTests { #expect(decoded.value == "basic_value") } - @Test + @Test("static properties are ignored in encoding") func staticPropertiesIgnored() throws { let original = SomeCodable(value: "test") let encoded = try JSONEncoder().encode(original) @@ -197,6 +202,7 @@ struct CodableTests { } } + @Suite("Codable - No Customization") struct WithOptionalTypeWithoutAnyCustomization { @Codable struct SomeCodable { @@ -205,7 +211,7 @@ struct CodableTests { let value3: String? } - @Test + @Test("expansion generates correct Codable implementation") func expansion() throws { assertMacroExpansion( """ @@ -254,6 +260,7 @@ struct CodableTests { } } + @Suite("Codable - Partial Conformance") struct OnlyDecodeConformance { @Codable struct SomeCodable: Encodable { @@ -263,7 +270,7 @@ struct CodableTests { } } - @Test + @Test("expansion generates correct Codable implementation") func expansion() throws { assertMacroExpansion( """ @@ -302,6 +309,7 @@ struct CodableTests { } } + @Suite("Codable - Partial Conformance") struct OnlyEncodeConformance { @Codable struct SomeCodable: Decodable { @@ -312,7 +320,7 @@ struct CodableTests { } } - @Test + @Test("expansion generates correct Codable implementation") func expansion() throws { assertMacroExpansion( """ @@ -353,6 +361,7 @@ struct CodableTests { } } + @Suite("Codable - Ignored Codable Conformance") struct IgnoredCodableConformance { @Codable struct SomeCodable: Swift.Codable { @@ -366,7 +375,7 @@ struct CodableTests { } } - @Test + @Test("expansion generates correct Codable implementation") func expansion() throws { assertMacroExpansion( """ @@ -400,6 +409,7 @@ struct CodableTests { } } + @Suite("Codable - Super Class Codable Conformance") struct SuperClassCodableConformance { class SuperCodable: Swift.Codable {} enum AnotherDecoder {} @@ -418,7 +428,7 @@ struct CodableTests { } } - @Test + @Test("expansion generates correct Codable implementation") func expansion() throws { assertMacroExpansion( """ @@ -468,6 +478,7 @@ struct CodableTests { } } + @Suite("Codable - Class Ignored Codable Conformance") struct ClassIgnoredCodableConformance { @Codable class SomeCodable: Swift.Codable { @@ -481,7 +492,7 @@ struct CodableTests { } } - @Test + @Test("expansion generates correct Codable implementation") func expansion() throws { assertMacroExpansion( """ @@ -515,6 +526,7 @@ struct CodableTests { } } + @Suite("Codable - Without") struct ClassIgnoredCodableConformanceWithoutAny { @Codable class SomeCodable: Swift.Codable { @@ -528,7 +540,7 @@ struct CodableTests { } } - @Test + @Test("expansion generates correct Codable implementation") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift index b8a3576684..25e0066758 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift @@ -5,8 +5,9 @@ import Testing @testable import PluginCore +@Suite("Coded As Enum Tests") struct CodedAsEnumTests { - @Test + @Test("misuse On Non Case Declaration") func misuseOnNonCaseDeclaration() throws { assertMacroExpansion( """ @@ -46,7 +47,7 @@ struct CodedAsEnumTests { ) } - @Test + @Test("invalid Range Expression Type Diagnostic") func invalidRangeExpressionTypeDiagnostic() throws { assertMacroExpansion( """ @@ -164,7 +165,7 @@ struct CodedAsEnumTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -209,7 +210,7 @@ struct CodedAsEnumTests { ) } - @Test + @Test("misuse In Combination With Ignore Coding Macro") func misuseInCombinationWithIgnoreCodingMacro() throws { assertMacroExpansion( """ @@ -254,7 +255,7 @@ struct CodedAsEnumTests { ) } - @Test + @Test("misuse On Non Enum Declaration") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -301,6 +302,7 @@ struct CodedAsEnumTests { ) } + @Suite("Coded As Enum - CodedBy") struct WithCodedByMacro { @Codable @CodedAt("type") @@ -313,7 +315,7 @@ struct CodedAsEnumTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -398,6 +400,7 @@ struct CodedAsEnumTests { } } + @Suite("Coded As Enum - Externally Tagged Custom Value") struct ExternallyTaggedCustomValue { @Codable enum SomeEnum { @@ -410,7 +413,7 @@ struct CodedAsEnumTests { case multi(_ variable: Bool, val: Int, String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -531,6 +534,7 @@ struct CodedAsEnumTests { } } + @Suite("Coded As Enum - Internally Tagged Custom Value") struct InternallyTaggedCustomValue { @Codable @CodedAt("type") @@ -544,7 +548,7 @@ struct CodedAsEnumTests { case multi(_ variable: Bool, val: Int, String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift index c29de92d8f..ccff29be4d 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift @@ -5,8 +5,9 @@ import Testing @testable import PluginCore +@Suite("Coded As Tests") struct CodedAsTests { - @Test + @Test("misuse On Grouped Variable Declaration") func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -27,7 +28,7 @@ struct CodedAsTests { ) } - @Test + @Test("misuse On Static Variable Declaration") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -56,7 +57,7 @@ struct CodedAsTests { ) } - @Test + @Test("misuse In Combination With Ignore Coding Macro") func misuseInCombinationWithIgnoreCodingMacro() throws { assertMacroExpansion( """ @@ -95,7 +96,7 @@ struct CodedAsTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -134,6 +135,7 @@ struct CodedAsTests { ) } + @Suite("Coded As - With Value") struct WithValue { @Codable struct SomeCodable { @@ -143,7 +145,7 @@ struct CodedAsTests { let value1: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -211,7 +213,7 @@ struct CodedAsTests { ) } - @Test + @Test("coded As Key Mapping") func codedAsKeyMapping() throws { let original = SomeCodable(value: "test1", value1: "test2") let encoded = try JSONEncoder().encode(original) @@ -221,7 +223,7 @@ struct CodedAsTests { #expect(decoded.value1 == "test2") } - @Test + @Test("coded As From J S O N") func codedAsFromJSON() throws { let jsonStr = """ { @@ -236,7 +238,7 @@ struct CodedAsTests { #expect(decoded.value1 == "multi_mapped_value") } - @Test + @Test("coded As Alternative Keys") func codedAsAlternativeKeys() throws { // Test with key2 instead of key1 let jsonStr = """ @@ -252,7 +254,7 @@ struct CodedAsTests { #expect(decoded.value1 == "alternative_key_value") } - @Test + @Test("coded As J S O N Structure") func codedAsJSONStructure() throws { let original = SomeCodable(value: "test", value1: "test2") let encoded = try JSONEncoder().encode(original) @@ -270,6 +272,7 @@ struct CodedAsTests { } } + @Suite("Coded As - With Any Codable Literal Enum") struct WithAnyCodableLiteralEnum { @Codable @CodedAt("type") @@ -280,7 +283,7 @@ struct CodedAsTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -444,7 +447,7 @@ struct CodedAsTests { ) } - @Test + @Test("enum Mixed Literal Roundtrip") func enumMixedLiteralRoundtrip() throws { let loadCmd: Command = .load(key: "test_key") let encoded = try JSONEncoder().encode(loadCmd) @@ -457,7 +460,7 @@ struct CodedAsTests { } } - @Test + @Test("enum String Type Decoding") func enumStringTypeDecoding() throws { let jsonStr = """ { @@ -475,7 +478,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Integer Type Decoding") func enumIntegerTypeDecoding() throws { let jsonStr = """ { @@ -493,7 +496,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Boolean Type Decoding") func enumBooleanTypeDecoding() throws { let jsonStr = """ { @@ -511,7 +514,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Double Type Decoding") func enumDoubleTypeDecoding() throws { let jsonStr = """ { @@ -529,7 +532,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Store With Integer Type") func enumStoreWithIntegerType() throws { let jsonStr = """ { @@ -549,7 +552,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Store With Boolean Type") func enumStoreWithBooleanType() throws { let jsonStr = """ { @@ -569,7 +572,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Store With Double Type") func enumStoreWithDoubleType() throws { let jsonStr = """ { @@ -589,7 +592,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Encoding Structure") func enumEncodingStructure() throws { let storeCmd: Command = .store(key: "test", value: 100) let encoded = try JSONEncoder().encode(storeCmd) @@ -603,7 +606,7 @@ struct CodedAsTests { #expect(json["value"] as? Int == 100) } - @Test + @Test("enum Load Encoding Structure") func enumLoadEncodingStructure() throws { let loadCmd: Command = .load(key: "load_test") let encoded = try JSONEncoder().encode(loadCmd) @@ -617,7 +620,7 @@ struct CodedAsTests { #expect(json["value"] == nil) // No value for load case } - @Test + @Test("enum Invalid Type Decoding") func enumInvalidTypeDecoding() throws { let jsonStr = """ { @@ -632,7 +635,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Missing Type Decoding") func enumMissingTypeDecoding() throws { let jsonStr = """ { @@ -646,7 +649,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Integer Range Load Case") func enumIntegerRangeLoadCase() throws { // Test integer in range 15..<20 for load case let jsonStr = """ @@ -666,7 +669,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Integer Range Store Case") func enumIntegerRangeStoreCase() throws { // Test integer in range 35...40 for store case let jsonStr = """ @@ -688,7 +691,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Integer Range Boundary Values") func enumIntegerRangeBoundaryValues() throws { // Test boundary values for ranges @@ -769,7 +772,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Double Partial Range Load Case") func enumDoublePartialRangeLoadCase() throws { // Test double in partial range (-0.8)... for load case let jsonStr = """ @@ -789,7 +792,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Double Partial Range Store Case") func enumDoublePartialRangeStoreCase() throws { // Test double in partial range ..<(-1.5) for store case let jsonStr = """ @@ -811,7 +814,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Double Range Boundary Values") func enumDoubleRangeBoundaryValues() throws { // Test boundary values for double ranges @@ -850,7 +853,7 @@ struct CodedAsTests { } } - @Test + @Test("enum Range Values Priority Over Literals") func enumRangeValuesPriorityOverLiterals() throws { // Test that range values work alongside literal values // Integer 16 should match the range 15..<20 for load case, not the literal 12 @@ -872,6 +875,7 @@ struct CodedAsTests { } } + @Suite("Coded As - With Helper And Value") struct WithHelperAndValue { @Codable struct SomeCodable { @@ -887,7 +891,7 @@ struct CodedAsTests { let value1: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -958,6 +962,7 @@ struct CodedAsTests { } } + @Suite("Coded As - Default") struct WithDefaultValue { @Codable struct SomeCodable { @@ -969,7 +974,7 @@ struct CodedAsTests { let value1: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -1053,6 +1058,7 @@ struct CodedAsTests { } } + @Suite("Coded As - With Helper And Default Value") struct WithHelperAndDefaultValue { @Codable struct SomeCodable { @@ -1070,7 +1076,7 @@ struct CodedAsTests { let value1: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -1156,6 +1162,7 @@ struct CodedAsTests { } } + @Suite("Coded As - Coding Key Case Name Collision Handling") struct CodingKeyCaseNameCollisionHandling { @Codable struct TestCodable { @@ -1163,7 +1170,7 @@ struct CodedAsTests { var fooBar: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -1214,6 +1221,7 @@ struct CodedAsTests { } } + @Suite("Coded As - Coding Key Case Name Collision Handling With Duplicate Aliases") struct CodingKeyCaseNameCollisionHandlingWithDuplicateAliases { @Codable struct TestCodable { @@ -1221,7 +1229,7 @@ struct CodedAsTests { var fooBar: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift index fa593e5890..94f37741ab 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift @@ -3,7 +3,9 @@ import Testing @testable import PluginCore +@Suite("Coded At Default Choice Tests") struct CodedAtDefaultChoiceTests { + @Suite("Coded At Default Choice - With No Path") struct WithNoPath { @Codable @MemberInit @@ -13,7 +15,7 @@ struct CodedAtDefaultChoiceTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -55,6 +57,7 @@ struct CodedAtDefaultChoiceTests { } } + @Suite("Coded At Default Choice - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -64,7 +67,7 @@ struct CodedAtDefaultChoiceTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -105,6 +108,7 @@ struct CodedAtDefaultChoiceTests { ) } + @Suite("Coded At Default Choice - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -114,7 +118,7 @@ struct CodedAtDefaultChoiceTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -157,6 +161,7 @@ struct CodedAtDefaultChoiceTests { } } + @Suite("Coded At Default Choice - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -166,7 +171,7 @@ struct CodedAtDefaultChoiceTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -220,6 +225,7 @@ struct CodedAtDefaultChoiceTests { } } + @Suite("Coded At Default Choice - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -229,7 +235,7 @@ struct CodedAtDefaultChoiceTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -282,6 +288,7 @@ struct CodedAtDefaultChoiceTests { ) } + @Suite("Coded At Default Choice - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -291,7 +298,7 @@ struct CodedAtDefaultChoiceTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -346,6 +353,7 @@ struct CodedAtDefaultChoiceTests { } } + @Suite("Coded At Default Choice - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -355,7 +363,7 @@ struct CodedAtDefaultChoiceTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -443,6 +451,7 @@ struct CodedAtDefaultChoiceTests { } } + @Suite("Coded At Default Choice - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -452,7 +461,7 @@ struct CodedAtDefaultChoiceTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -539,6 +548,7 @@ struct CodedAtDefaultChoiceTests { ) } + @Suite("Coded At Default Choice - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -548,7 +558,7 @@ struct CodedAtDefaultChoiceTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -637,6 +647,7 @@ struct CodedAtDefaultChoiceTests { } } + @Suite("Coded At Default Choice - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -653,7 +664,7 @@ struct CodedAtDefaultChoiceTests { let value4: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -758,6 +769,7 @@ struct CodedAtDefaultChoiceTests { } } + @Suite("Coded At Default Choice - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -779,7 +791,7 @@ struct CodedAtDefaultChoiceTests { let value6: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -909,6 +921,7 @@ struct CodedAtDefaultChoiceTests { } } + @Suite("Coded At Default Choice - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -929,7 +942,7 @@ struct CodedAtDefaultChoiceTests { let value6: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift index 40a6e517ed..3ff4685350 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift @@ -3,7 +3,9 @@ import Testing @testable import PluginCore +@Suite("Coded At Default Only Missing Tests") struct CodedAtDefaultOnlyMissingTests { + @Suite("Coded At Default Only Missing - With No Path") struct WithNoPath { @Codable @MemberInit @@ -13,7 +15,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -51,6 +53,7 @@ struct CodedAtDefaultOnlyMissingTests { } } + @Suite("Coded At Default Only Missing - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -60,7 +63,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -97,6 +100,7 @@ struct CodedAtDefaultOnlyMissingTests { ) } + @Suite("Coded At Default Only Missing - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -106,7 +110,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -145,6 +149,7 @@ struct CodedAtDefaultOnlyMissingTests { } } + @Suite("Coded At Default Only Missing - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -154,7 +159,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -200,6 +205,7 @@ struct CodedAtDefaultOnlyMissingTests { } } + @Suite("Coded At Default Only Missing - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -209,7 +215,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -254,6 +260,7 @@ struct CodedAtDefaultOnlyMissingTests { ) } + @Suite("Coded At Default Only Missing - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -263,7 +270,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -310,6 +317,7 @@ struct CodedAtDefaultOnlyMissingTests { } } + @Suite("Coded At Default Only Missing - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -319,7 +327,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -379,6 +387,7 @@ struct CodedAtDefaultOnlyMissingTests { } } + @Suite("Coded At Default Only Missing - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -388,7 +397,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -447,6 +456,7 @@ struct CodedAtDefaultOnlyMissingTests { ) } + @Suite("Coded At Default Only Missing - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -456,7 +466,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -517,6 +527,7 @@ struct CodedAtDefaultOnlyMissingTests { } } + @Suite("Coded At Default Only Missing - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -533,7 +544,7 @@ struct CodedAtDefaultOnlyMissingTests { let value4: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -619,6 +630,7 @@ struct CodedAtDefaultOnlyMissingTests { } } + @Suite("Coded At Default Only Missing - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -640,7 +652,7 @@ struct CodedAtDefaultOnlyMissingTests { let value6: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -746,6 +758,7 @@ struct CodedAtDefaultOnlyMissingTests { } } + @Suite("Coded At Default Only Missing - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -766,7 +779,7 @@ struct CodedAtDefaultOnlyMissingTests { let value6: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift index 4013976240..b6275d8780 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift @@ -3,7 +3,9 @@ import Testing @testable import PluginCore +@Suite("Coded At Default Tests") struct CodedAtDefaultTests { + @Suite("Coded At Default - With No Path") struct WithNoPath { @Codable @MemberInit @@ -13,7 +15,7 @@ struct CodedAtDefaultTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -55,6 +57,7 @@ struct CodedAtDefaultTests { } } + @Suite("Coded At Default - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -64,7 +67,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -105,6 +108,7 @@ struct CodedAtDefaultTests { ) } + @Suite("Coded At Default - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -114,7 +118,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -157,6 +161,7 @@ struct CodedAtDefaultTests { } } + @Suite("Coded At Default - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -166,7 +171,7 @@ struct CodedAtDefaultTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -220,6 +225,7 @@ struct CodedAtDefaultTests { } } + @Suite("Coded At Default - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -229,7 +235,7 @@ struct CodedAtDefaultTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -282,6 +288,7 @@ struct CodedAtDefaultTests { ) } + @Suite("Coded At Default - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -291,7 +298,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -346,6 +353,7 @@ struct CodedAtDefaultTests { } } + @Suite("Coded At Default - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -355,7 +363,7 @@ struct CodedAtDefaultTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -443,6 +451,7 @@ struct CodedAtDefaultTests { } } + @Suite("Coded At Default - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -452,7 +461,7 @@ struct CodedAtDefaultTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -539,6 +548,7 @@ struct CodedAtDefaultTests { ) } + @Suite("Coded At Default - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -548,7 +558,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -637,6 +647,7 @@ struct CodedAtDefaultTests { } } + @Suite("Coded At Default - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -653,7 +664,7 @@ struct CodedAtDefaultTests { let value4: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -758,6 +769,7 @@ struct CodedAtDefaultTests { } } + @Suite("Coded At Default - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -779,7 +791,7 @@ struct CodedAtDefaultTests { let value6: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -909,6 +921,7 @@ struct CodedAtDefaultTests { } } + @Suite("Coded At Default - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -928,7 +941,7 @@ struct CodedAtDefaultTests { let value6: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift index bb7eddd2fc..85d51f3088 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift @@ -4,8 +4,9 @@ import Testing @testable import PluginCore +@Suite("Coded At Enum Tests") struct CodedAtEnumTests { - @Test + @Test("misuse On Non Enum Declaration") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -40,7 +41,7 @@ struct CodedAtEnumTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -175,6 +176,7 @@ struct CodedAtEnumTests { ) } + @Suite("Coded At Enum - Without Explicit Type") struct WithoutExplicitType { @Codable @CodedAt("type") @@ -183,7 +185,7 @@ struct CodedAtEnumTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -274,6 +276,7 @@ struct CodedAtEnumTests { } } + @Suite("Coded At Enum - Explicit") struct WithExplicitType { @Codable @CodedAt("type") @@ -285,7 +288,7 @@ struct CodedAtEnumTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -369,6 +372,7 @@ struct CodedAtEnumTests { } } + @Suite("Coded At Enum - With Helper Expression") struct WithHelperExpression { @Codable @CodedAt("type") @@ -381,7 +385,7 @@ struct CodedAtEnumTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -466,6 +470,7 @@ struct CodedAtEnumTests { } } + @Suite("Coded At Enum - With Nested Optional Identifier") struct WithNestedOptionalIdentifier { @Codable @CodedAs @@ -495,7 +500,7 @@ struct CodedAtEnumTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift index c8d4e91534..6982fdcb35 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift @@ -4,7 +4,9 @@ import Testing @testable import PluginCore +@Suite("Coded At Helper Default Tests") struct CodedAtHelperDefaultTests { + @Suite("Coded At Helper Default - With No Path") struct WithNoPath { @Codable @MemberInit @@ -17,7 +19,7 @@ struct CodedAtHelperDefaultTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -60,6 +62,7 @@ struct CodedAtHelperDefaultTests { } } + @Suite("Coded At Helper Default - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -72,7 +75,7 @@ struct CodedAtHelperDefaultTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -115,6 +118,7 @@ struct CodedAtHelperDefaultTests { } } + @Suite("Coded At Helper Default - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -127,7 +131,7 @@ struct CodedAtHelperDefaultTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -182,6 +186,7 @@ struct CodedAtHelperDefaultTests { } } + @Suite("Coded At Helper Default - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -194,7 +199,7 @@ struct CodedAtHelperDefaultTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -249,6 +254,7 @@ struct CodedAtHelperDefaultTests { } } + @Suite("Coded At Helper Default - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -261,7 +267,7 @@ struct CodedAtHelperDefaultTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -350,6 +356,7 @@ struct CodedAtHelperDefaultTests { } } + @Suite("Coded At Helper Default - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -362,7 +369,7 @@ struct CodedAtHelperDefaultTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -451,6 +458,7 @@ struct CodedAtHelperDefaultTests { } } + @Suite("Coded At Helper Default - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -479,7 +487,7 @@ struct CodedAtHelperDefaultTests { let value5: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -602,6 +610,7 @@ struct CodedAtHelperDefaultTests { } } + @Suite("Coded At Helper Default - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -634,7 +643,7 @@ struct CodedAtHelperDefaultTests { let value6: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -760,6 +769,7 @@ struct CodedAtHelperDefaultTests { } } + @Suite("Coded At Helper Default - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -791,7 +801,7 @@ struct CodedAtHelperDefaultTests { let value6: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift index 589873b438..c52c22b576 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift @@ -5,7 +5,9 @@ import Testing @testable import PluginCore +@Suite("Coded At Helper Tests") struct CodedAtHelperTests { + @Suite("Coded At Helper - With No Path") struct WithNoPath { @Codable @MemberInit @@ -17,7 +19,7 @@ struct CodedAtHelperTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -54,7 +56,7 @@ struct CodedAtHelperTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = SomeCodable(value: ["test1", "test2"]) let encoded = try JSONEncoder().encode(original) @@ -63,7 +65,7 @@ struct CodedAtHelperTests { #expect(decoded.value == ["test1", "test2"]) } - @Test + @Test("decoding From J S O N Array") func decodingFromJSONArray() throws { let jsonStr = """ ["value1", "value2", "value3"] @@ -74,7 +76,7 @@ struct CodedAtHelperTests { #expect(decoded.value == ["value1", "value2", "value3"]) } - @Test + @Test("lossy Decoding With Invalid Values") func lossyDecodingWithInvalidValues() throws { let jsonStr = """ ["valid", 123, "another_valid", null, true] @@ -87,6 +89,7 @@ struct CodedAtHelperTests { } } + @Suite("Coded At Helper - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -98,7 +101,7 @@ struct CodedAtHelperTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -136,6 +139,7 @@ struct CodedAtHelperTests { } } + @Suite("Coded At Helper - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -147,7 +151,7 @@ struct CodedAtHelperTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -193,6 +197,7 @@ struct CodedAtHelperTests { } } + @Suite("Coded At Helper - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -204,7 +209,7 @@ struct CodedAtHelperTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -250,6 +255,7 @@ struct CodedAtHelperTests { } } + @Suite("Coded At Helper - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -261,7 +267,7 @@ struct CodedAtHelperTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -313,6 +319,7 @@ struct CodedAtHelperTests { } } + @Suite("Coded At Helper - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -324,7 +331,7 @@ struct CodedAtHelperTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -384,6 +391,7 @@ struct CodedAtHelperTests { } } + @Suite("Coded At Helper - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -405,7 +413,7 @@ struct CodedAtHelperTests { let value3: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -484,6 +492,7 @@ struct CodedAtHelperTests { } } + @Suite("Coded At Helper - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -500,7 +509,7 @@ struct CodedAtHelperTests { let value2: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -560,6 +569,7 @@ struct CodedAtHelperTests { } } + @Suite("Coded At Helper - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -575,7 +585,7 @@ struct CodedAtHelperTests { let value2: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift index e1a2edc22d..4c05a05240 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift @@ -4,8 +4,9 @@ import Testing @testable import PluginCore +@Suite("Coded At Tests") struct CodedAtTests { - @Test + @Test("misuse On Non Variable Declaration") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -36,7 +37,7 @@ struct CodedAtTests { ) } - @Test + @Test("misuse On Grouped Variable Declaration") func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +58,7 @@ struct CodedAtTests { ) } - @Test + @Test("misuse On Static Variable Declaration") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -86,7 +87,7 @@ struct CodedAtTests { ) } - @Test + @Test("misuse In Combination With Coded In Macro") func misuseInCombinationWithCodedInMacro() throws { assertMacroExpansion( """ @@ -125,7 +126,7 @@ struct CodedAtTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -164,6 +165,7 @@ struct CodedAtTests { ) } + @Suite("Coded At - With No Path") struct WithNoPath { @Codable @MemberInit @@ -172,7 +174,7 @@ struct CodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -209,6 +211,7 @@ struct CodedAtTests { } } + @Suite("Coded At - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -217,7 +220,7 @@ struct CodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -253,6 +256,7 @@ struct CodedAtTests { ) } + @Suite("Coded At - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -261,7 +265,7 @@ struct CodedAtTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -299,6 +303,7 @@ struct CodedAtTests { } } + @Suite("Coded At - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -307,7 +312,7 @@ struct CodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -351,7 +356,7 @@ struct CodedAtTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = SomeCodable(value: "test") let encoded = try JSONEncoder().encode(original) @@ -360,7 +365,7 @@ struct CodedAtTests { #expect(decoded.value == "test") } - @Test + @Test("decoding From J S O N") func decodingFromJSON() throws { let jsonStr = """ { @@ -373,7 +378,7 @@ struct CodedAtTests { #expect(decoded.value == "custom_value") } - @Test + @Test("encoding To J S O N") func encodingToJSON() throws { let original = SomeCodable(value: "encoded_value") let encoded = try JSONEncoder().encode(original) @@ -384,6 +389,7 @@ struct CodedAtTests { } } + @Suite("Coded At - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -392,7 +398,7 @@ struct CodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -436,7 +442,7 @@ struct CodedAtTests { ) } - @Test + @Test("decoding And Encoding With Value") func decodingAndEncodingWithValue() throws { let original = SomeCodable(value: "optional_test") let encoded = try JSONEncoder().encode(original) @@ -445,7 +451,7 @@ struct CodedAtTests { #expect(decoded.value == "optional_test") } - @Test + @Test("decoding And Encoding With Nil") func decodingAndEncodingWithNil() throws { let original = SomeCodable(value: nil) let encoded = try JSONEncoder().encode(original) @@ -454,7 +460,7 @@ struct CodedAtTests { #expect(decoded.value == nil) } - @Test + @Test("decoding From J S O N With Missing Key") func decodingFromJSONWithMissingKey() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -463,6 +469,7 @@ struct CodedAtTests { #expect(decoded.value == nil) } + @Suite("Coded At - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -471,7 +478,7 @@ struct CodedAtTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -517,6 +524,7 @@ struct CodedAtTests { } } + @Suite("Coded At - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -525,7 +533,7 @@ struct CodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -576,6 +584,7 @@ struct CodedAtTests { } } + @Suite("Coded At - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -584,7 +593,7 @@ struct CodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -642,6 +651,7 @@ struct CodedAtTests { ) } + @Suite("Coded At - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -650,7 +660,7 @@ struct CodedAtTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -710,6 +720,7 @@ struct CodedAtTests { } } + @Suite("Coded At - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -724,7 +735,7 @@ struct CodedAtTests { let value4: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -808,6 +819,7 @@ struct CodedAtTests { } } + @Suite("Coded At - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -820,7 +832,7 @@ struct CodedAtTests { let value3: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -885,6 +897,7 @@ struct CodedAtTests { } } + @Suite("Coded At - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -896,7 +909,7 @@ struct CodedAtTests { let value3: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -954,6 +967,7 @@ struct CodedAtTests { } } + @Suite("Coded At - Actor With Nested Path On Mixed Types") struct ActorWithNestedPathOnMixedTypes { #if swift(<6) @MemberInit @@ -968,7 +982,7 @@ struct CodedAtTests { } #endif - @Test + @Test("expansion") func expansion() throws { #if swift(>=6) let decodablePrefix = "@preconcurrency " diff --git a/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift b/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift index e6642b9616..ed5f3be2c5 100644 --- a/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift +++ b/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift @@ -3,8 +3,9 @@ import Testing @testable import PluginCore +@Suite("Decoded At Tests") struct DecodedAtTests { - @Test + @Test("misuse On Non Variable Declaration") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -35,7 +36,7 @@ struct DecodedAtTests { ) } - @Test + @Test("misuse On Grouped Variable Declaration") func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -56,7 +57,7 @@ struct DecodedAtTests { ) } - @Test + @Test("misuse On Static Variable Declaration") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -85,7 +86,7 @@ struct DecodedAtTests { ) } - @Test + @Test("misuse In Combination With Coded In Macro") func misuseInCombinationWithCodedInMacro() throws { assertMacroExpansion( """ @@ -124,7 +125,7 @@ struct DecodedAtTests { ) } - @Test + @Test("misuse In Combination With Coded At Macro") func misuseInCombinationWithCodedAtMacro() throws { assertMacroExpansion( """ @@ -163,7 +164,7 @@ struct DecodedAtTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -202,6 +203,7 @@ struct DecodedAtTests { ) } + @Suite("Decoded At - With No Path") struct WithNoPath { @Codable @MemberInit @@ -210,7 +212,7 @@ struct DecodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -254,6 +256,7 @@ struct DecodedAtTests { } } + @Suite("Decoded At - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -262,7 +265,7 @@ struct DecodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -305,6 +308,7 @@ struct DecodedAtTests { ) } + @Suite("Decoded At - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -313,7 +317,7 @@ struct DecodedAtTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -358,6 +362,7 @@ struct DecodedAtTests { } } + @Suite("Decoded At - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -366,7 +371,7 @@ struct DecodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -412,6 +417,7 @@ struct DecodedAtTests { } } + @Suite("Decoded At - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -420,7 +426,7 @@ struct DecodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -465,6 +471,7 @@ struct DecodedAtTests { ) } + @Suite("Decoded At - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -473,7 +480,7 @@ struct DecodedAtTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -520,6 +527,7 @@ struct DecodedAtTests { } } + @Suite("Decoded At - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -528,7 +536,7 @@ struct DecodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -578,6 +586,7 @@ struct DecodedAtTests { } } + @Suite("Decoded At - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -586,7 +595,7 @@ struct DecodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -644,6 +653,7 @@ struct DecodedAtTests { } } + @Suite("Decoded At - DecodedAt") struct WithDecodedAtAndEncodedAt { @Codable @MemberInit @@ -653,7 +663,7 @@ struct DecodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -703,6 +713,7 @@ struct DecodedAtTests { } } + @Suite("Decoded At - DecodedAt") struct WithDecodedAtAndEncodedAtOnOptionalType { @Codable @MemberInit @@ -712,7 +723,7 @@ struct DecodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift b/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift index 28e49273df..048a645c72 100644 --- a/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift +++ b/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift @@ -3,8 +3,9 @@ import Testing @testable import PluginCore +@Suite("Encoded At Tests") struct EncodedAtTests { - @Test + @Test("misuse On Non Variable Declaration") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -35,7 +36,7 @@ struct EncodedAtTests { ) } - @Test + @Test("misuse On Grouped Variable Declaration") func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -56,7 +57,7 @@ struct EncodedAtTests { ) } - @Test + @Test("misuse On Static Variable Declaration") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -85,7 +86,7 @@ struct EncodedAtTests { ) } - @Test + @Test("misuse In Combination With Coded In Macro") func misuseInCombinationWithCodedInMacro() throws { assertMacroExpansion( """ @@ -124,7 +125,7 @@ struct EncodedAtTests { ) } - @Test + @Test("misuse In Combination With Coded At Macro") func misuseInCombinationWithCodedAtMacro() throws { assertMacroExpansion( """ @@ -163,7 +164,7 @@ struct EncodedAtTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -202,6 +203,7 @@ struct EncodedAtTests { ) } + @Suite("Encoded At - With No Path") struct WithNoPath { @Codable @MemberInit @@ -210,7 +212,7 @@ struct EncodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -254,6 +256,7 @@ struct EncodedAtTests { } } + @Suite("Encoded At - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -262,7 +265,7 @@ struct EncodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -305,6 +308,7 @@ struct EncodedAtTests { ) } + @Suite("Encoded At - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -313,7 +317,7 @@ struct EncodedAtTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -358,6 +362,7 @@ struct EncodedAtTests { } } + @Suite("Encoded At - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -366,7 +371,7 @@ struct EncodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -412,6 +417,7 @@ struct EncodedAtTests { } } + @Suite("Encoded At - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -420,7 +426,7 @@ struct EncodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -465,6 +471,7 @@ struct EncodedAtTests { ) } + @Suite("Encoded At - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -473,7 +480,7 @@ struct EncodedAtTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -520,6 +527,7 @@ struct EncodedAtTests { } } + @Suite("Encoded At - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -528,7 +536,7 @@ struct EncodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -578,6 +586,7 @@ struct EncodedAtTests { } } + @Suite("Encoded At - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -586,7 +595,7 @@ struct EncodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -636,6 +645,7 @@ struct EncodedAtTests { } } + @Suite("Encoded At - DecodedAt") struct WithDecodedAtAndEncodedAt { @Codable @MemberInit @@ -645,7 +655,7 @@ struct EncodedAtTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -695,6 +705,7 @@ struct EncodedAtTests { } } + @Suite("Encoded At - DecodedAt") struct WithDecodedAtAndEncodedAtOnOptionalType { @Codable @MemberInit @@ -704,7 +715,7 @@ struct EncodedAtTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift b/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift index 94d083cdd9..009d42f5af 100644 --- a/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift +++ b/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift @@ -5,8 +5,10 @@ import Testing @testable import PluginCore +@Suite("Coded By Action Tests") struct CodedByActionTests { // https://forums.swift.org/t/codable-passing-data-to-child-decoder/12757 + @Suite("Coded By Action - Dependency Before") struct DependencyBefore { @Codable struct Dog { @@ -42,7 +44,7 @@ struct CodedByActionTests { } } - @Test + @Test("expansion") func expansion() { assertMacroExpansion( """ @@ -168,7 +170,7 @@ struct CodedByActionTests { ) } - @Test + @Test("custom Coder Version Behavior") func customCoderVersionBehavior() throws { // Test version 1 behavior let dog1 = Dog(name: "Buddy", version: 1, info: Dog.Info(tag: 5)) @@ -187,7 +189,7 @@ struct CodedByActionTests { #expect(decoded2.info.tag == 5) // Should be 5 after encode(-1) then decode(+1) } - @Test + @Test("custom Coder From J S O N") func customCoderFromJSON() throws { let jsonStr = """ { @@ -207,6 +209,7 @@ struct CodedByActionTests { } // https://forums.swift.org/t/codable-passing-data-to-child-decoder/12757 + @Suite("Coded By Action - Dependency After") struct DependencyAfter { @Codable struct Dog { @@ -242,7 +245,7 @@ struct CodedByActionTests { } } - @Test + @Test("expansion") func expansion() { assertMacroExpansion( """ @@ -383,6 +386,7 @@ struct CodedByActionTests { } // https://stackoverflow.com/questions/62242365/access-property-of-parent-struct-in-a-nested-codable-struct-when-decoding-the-ch + @Suite("Coded By Action - Nested Property Dependency Before") struct NestedPropertyDependencyBefore { @Codable struct Item: Identifiable { @@ -423,7 +427,7 @@ struct CodedByActionTests { } } - @Test + @Test("expansion") func expansion() { assertMacroExpansion( """ @@ -564,6 +568,7 @@ struct CodedByActionTests { } // https://stackoverflow.com/questions/62242365/access-property-of-parent-struct-in-a-nested-codable-struct-when-decoding-the-ch + @Suite("Coded By Action - Nested Property Dependency After") struct NestedPropertyDependencyAfter { @Codable struct Item: Identifiable { @@ -604,7 +609,7 @@ struct CodedByActionTests { } } - @Test + @Test("expansion") func expansion() { assertMacroExpansion( """ @@ -758,6 +763,7 @@ struct CodedByActionTests { } } + @Suite("Coded By Action - Multi Chained Dependency") struct MultiChainedDependency { @Codable struct SomeCodable { @@ -802,7 +808,7 @@ struct CodedByActionTests { } } - @Test + @Test("expansion") func expansion() { assertMacroExpansion( """ @@ -971,6 +977,7 @@ struct CodedByActionTests { } } + @Suite("Coded By Action - Array Dependency") struct ArrayDependency { #if swift(>=6) @Codable @@ -1025,7 +1032,7 @@ struct CodedByActionTests { } #endif - @Test + @Test("expansion") func expansion() { assertMacroExpansion( """ @@ -1155,6 +1162,7 @@ struct CodedByActionTests { } } + @Suite("Coded By Action - Lossy Set Dependency") struct LossySetDependency { #if swift(>=6) @Codable @@ -1196,7 +1204,7 @@ struct CodedByActionTests { } #endif - @Test + @Test("expansion") func expansion() { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift index c5e1b546b7..28635a248f 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift @@ -3,7 +3,9 @@ import Testing @testable import PluginCore +@Suite("Coded In Default Tests") struct CodedInDefaultTests { + @Suite("Coded In Default - With No Path") struct WithNoPath { @Codable @MemberInit @@ -12,7 +14,7 @@ struct CodedInDefaultTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -65,6 +67,7 @@ struct CodedInDefaultTests { } } + @Suite("Coded In Default - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -74,7 +77,7 @@ struct CodedInDefaultTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -178,6 +181,7 @@ struct CodedInDefaultTests { } } + @Suite("Coded In Default - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -187,7 +191,7 @@ struct CodedInDefaultTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -258,6 +262,7 @@ struct CodedInDefaultTests { } } + @Suite("Coded In Default - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -267,7 +272,7 @@ struct CodedInDefaultTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -337,6 +342,7 @@ struct CodedInDefaultTests { ) } + @Suite("Coded In Default - Forced Unwrap") struct ForcedUnwrap { @Codable @MemberInit @@ -346,7 +352,7 @@ struct CodedInDefaultTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -418,6 +424,7 @@ struct CodedInDefaultTests { } } + @Suite("Coded In Default - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -427,7 +434,7 @@ struct CodedInDefaultTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -515,6 +522,7 @@ struct CodedInDefaultTests { } } + @Suite("Coded In Default - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -524,7 +532,7 @@ struct CodedInDefaultTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -611,6 +619,7 @@ struct CodedInDefaultTests { ) } + @Suite("Coded In Default - Force Unwrap") struct ForceUnwrap { @Codable @MemberInit @@ -620,7 +629,7 @@ struct CodedInDefaultTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -709,6 +718,7 @@ struct CodedInDefaultTests { } } + @Suite("Coded In Default - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -723,7 +733,7 @@ struct CodedInDefaultTests { let value3: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -820,6 +830,7 @@ struct CodedInDefaultTests { } } + @Suite("Coded In Default - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -841,7 +852,7 @@ struct CodedInDefaultTests { let value6: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -986,6 +997,7 @@ struct CodedInDefaultTests { } } + @Suite("Coded In Default - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -1006,7 +1018,7 @@ struct CodedInDefaultTests { let value6: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift index b7a48f428c..5bc572733c 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift @@ -4,7 +4,9 @@ import Testing @testable import PluginCore +@Suite("Coded In Helper Default Choice Tests") struct CodedInHelperDefaultChoiceTests { + @Suite("Coded In Helper Default Choice - With No Path") struct WithNoPath { @Codable @MemberInit @@ -16,7 +18,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -70,6 +72,7 @@ struct CodedInHelperDefaultChoiceTests { } } + @Suite("Coded In Helper Default Choice - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -82,7 +85,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -137,6 +140,7 @@ struct CodedInHelperDefaultChoiceTests { } } + @Suite("Coded In Helper Default Choice - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -149,7 +153,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -221,6 +225,7 @@ struct CodedInHelperDefaultChoiceTests { } } + @Suite("Coded In Helper Default Choice - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -233,7 +238,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -305,6 +310,7 @@ struct CodedInHelperDefaultChoiceTests { } } + @Suite("Coded In Helper Default Choice - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -317,7 +323,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -406,6 +412,7 @@ struct CodedInHelperDefaultChoiceTests { } } + @Suite("Coded In Helper Default Choice - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -418,7 +425,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -507,6 +514,7 @@ struct CodedInHelperDefaultChoiceTests { } } + @Suite("Coded In Helper Default Choice - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -535,7 +543,7 @@ struct CodedInHelperDefaultChoiceTests { let value5: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -658,6 +666,7 @@ struct CodedInHelperDefaultChoiceTests { } } + @Suite("Coded In Helper Default Choice - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -690,7 +699,7 @@ struct CodedInHelperDefaultChoiceTests { let value6: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -816,6 +825,7 @@ struct CodedInHelperDefaultChoiceTests { } } + @Suite("Coded In Helper Default Choice - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -847,7 +857,7 @@ struct CodedInHelperDefaultChoiceTests { let value6: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift index 5f10a5e310..3fbf7e8f15 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift @@ -4,7 +4,9 @@ import Testing @testable import PluginCore +@Suite("Coded In Helper Default Only Missing Tests") struct CodedInHelperDefaultOnlyMissingTests { + @Suite("Coded In Helper Default Only Missing - With No Path") struct WithNoPath { @Codable @MemberInit @@ -16,7 +18,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -62,6 +64,7 @@ struct CodedInHelperDefaultOnlyMissingTests { } } + @Suite("Coded In Helper Default Only Missing - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -74,7 +77,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -121,6 +124,7 @@ struct CodedInHelperDefaultOnlyMissingTests { } } + @Suite("Coded In Helper Default Only Missing - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -133,7 +137,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -187,6 +191,7 @@ struct CodedInHelperDefaultOnlyMissingTests { } } + @Suite("Coded In Helper Default Only Missing - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -199,7 +204,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -253,6 +258,7 @@ struct CodedInHelperDefaultOnlyMissingTests { } } + @Suite("Coded In Helper Default Only Missing - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -265,7 +271,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -326,6 +332,7 @@ struct CodedInHelperDefaultOnlyMissingTests { } } + @Suite("Coded In Helper Default Only Missing - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -338,7 +345,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -399,6 +406,7 @@ struct CodedInHelperDefaultOnlyMissingTests { } } + @Suite("Coded In Helper Default Only Missing - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -427,7 +435,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value5: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -526,6 +534,7 @@ struct CodedInHelperDefaultOnlyMissingTests { } } + @Suite("Coded In Helper Default Only Missing - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -558,7 +567,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value6: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -665,6 +674,7 @@ struct CodedInHelperDefaultOnlyMissingTests { } } + @Suite("Coded In Helper Default Only Missing - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -696,7 +706,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value6: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift index 77ce09c53d..0a48143656 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift @@ -4,7 +4,9 @@ import Testing @testable import PluginCore +@Suite("Coded In Helper Default Tests") struct CodedInHelperDefaultTests { + @Suite("Coded In Helper Default - With No Path") struct WithNoPath { @Codable @MemberInit @@ -16,7 +18,7 @@ struct CodedInHelperDefaultTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -70,6 +72,7 @@ struct CodedInHelperDefaultTests { } } + @Suite("Coded In Helper Default - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -82,7 +85,7 @@ struct CodedInHelperDefaultTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -137,6 +140,7 @@ struct CodedInHelperDefaultTests { } } + @Suite("Coded In Helper Default - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -149,7 +153,7 @@ struct CodedInHelperDefaultTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -221,6 +225,7 @@ struct CodedInHelperDefaultTests { } } + @Suite("Coded In Helper Default - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -233,7 +238,7 @@ struct CodedInHelperDefaultTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -305,6 +310,7 @@ struct CodedInHelperDefaultTests { } } + @Suite("Coded In Helper Default - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -317,7 +323,7 @@ struct CodedInHelperDefaultTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -406,6 +412,7 @@ struct CodedInHelperDefaultTests { } } + @Suite("Coded In Helper Default - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -418,7 +425,7 @@ struct CodedInHelperDefaultTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -507,6 +514,7 @@ struct CodedInHelperDefaultTests { } } + @Suite("Coded In Helper Default - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -535,7 +543,7 @@ struct CodedInHelperDefaultTests { let value5: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -658,6 +666,7 @@ struct CodedInHelperDefaultTests { } } + @Suite("Coded In Helper Default - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -690,7 +699,7 @@ struct CodedInHelperDefaultTests { let value6: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -816,6 +825,7 @@ struct CodedInHelperDefaultTests { } } + @Suite("Coded In Helper Default - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -847,7 +857,7 @@ struct CodedInHelperDefaultTests { let value6: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift index 16ac21ba84..dd0073eaa4 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift @@ -4,7 +4,9 @@ import Testing @testable import PluginCore +@Suite("Coded In Helper Tests") struct CodedInHelperTests { + @Suite("Coded In Helper - With No Path") struct WithNoPath { @Codable @MemberInit @@ -15,7 +17,7 @@ struct CodedInHelperTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -60,6 +62,7 @@ struct CodedInHelperTests { } } + @Suite("Coded In Helper - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -71,7 +74,7 @@ struct CodedInHelperTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -117,6 +120,7 @@ struct CodedInHelperTests { } } + @Suite("Coded In Helper - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -128,7 +132,7 @@ struct CodedInHelperTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -177,6 +181,7 @@ struct CodedInHelperTests { } } + @Suite("Coded In Helper - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -188,7 +193,7 @@ struct CodedInHelperTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -241,6 +246,7 @@ struct CodedInHelperTests { } } + @Suite("Coded In Helper - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -252,7 +258,7 @@ struct CodedInHelperTests { let value: [String] } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -304,6 +310,7 @@ struct CodedInHelperTests { } } + @Suite("Coded In Helper - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -315,7 +322,7 @@ struct CodedInHelperTests { let value: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -375,6 +382,7 @@ struct CodedInHelperTests { } } + @Suite("Coded In Helper - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -396,7 +404,7 @@ struct CodedInHelperTests { let value3: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -475,6 +483,7 @@ struct CodedInHelperTests { } } + @Suite("Coded In Helper - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -491,7 +500,7 @@ struct CodedInHelperTests { let value2: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -551,6 +560,7 @@ struct CodedInHelperTests { } } + @Suite("Coded In Helper - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -566,7 +576,7 @@ struct CodedInHelperTests { let value2: [String]? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInTests.swift index e52ad0cb43..1302fe7caf 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInTests.swift @@ -4,8 +4,9 @@ import Testing @testable import PluginCore +@Suite("Coded In Tests") struct CodedInTests { - @Test + @Test("misuse On Non Variable Declaration") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -36,7 +37,7 @@ struct CodedInTests { ) } - @Test + @Test("misuse On Static Variable Declaration") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -65,7 +66,7 @@ struct CodedInTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -104,6 +105,7 @@ struct CodedInTests { ) } + @Suite("Coded In - With No Path") struct WithNoPath { @Codable @MemberInit @@ -112,7 +114,7 @@ struct CodedInTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -157,6 +159,7 @@ struct CodedInTests { } } + @Suite("Coded In - With No Path On Optional Type") struct WithNoPathOnOptionalType { @Codable @MemberInit @@ -165,7 +168,7 @@ struct CodedInTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -251,6 +254,7 @@ struct CodedInTests { } } + @Suite("Coded In - With Single Path") struct WithSinglePath { @Codable @MemberInit @@ -259,7 +263,7 @@ struct CodedInTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -307,6 +311,7 @@ struct CodedInTests { } } + @Suite("Coded In - With Single Path On Optional Type") struct WithSinglePathOnOptionalType { @Codable @MemberInit @@ -315,7 +320,7 @@ struct CodedInTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -415,6 +420,7 @@ struct CodedInTests { } } + @Suite("Coded In - With Nested Path") struct WithNestedPath { @Codable @MemberInit @@ -423,7 +429,7 @@ struct CodedInTests { let value: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -473,7 +479,7 @@ struct CodedInTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = SomeCodable(value: "nested_test") let encoded = try JSONEncoder().encode(original) @@ -482,7 +488,7 @@ struct CodedInTests { #expect(decoded.value == "nested_test") } - @Test + @Test("decoding From Nested J S O N") func decodingFromNestedJSON() throws { let jsonStr = """ { @@ -499,7 +505,7 @@ struct CodedInTests { #expect(decoded.value == "deep_value") } - @Test + @Test("encoding To Nested J S O N") func encodingToNestedJSON() throws { let original = SomeCodable(value: "encoded_nested") let encoded = try JSONEncoder().encode(original) @@ -512,6 +518,7 @@ struct CodedInTests { } } + @Suite("Coded In - With Nested Path On Optional Type") struct WithNestedPathOnOptionalType { @Codable @MemberInit @@ -520,7 +527,7 @@ struct CodedInTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -578,6 +585,7 @@ struct CodedInTests { ) } + @Suite("Coded In - Forced Unwrap") struct ForcedUnwrap { @Codable @MemberInit @@ -586,7 +594,7 @@ struct CodedInTests { let value: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -646,6 +654,7 @@ struct CodedInTests { } } + @Suite("Coded In - With Nested Path On Multi Optional Types") struct WithNestedPathOnMultiOptionalTypes { @Codable @MemberInit @@ -658,7 +667,7 @@ struct CodedInTests { let value3: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -746,6 +755,7 @@ struct CodedInTests { } } + @Suite("Coded In - With Nested Path On Mixed Types") struct WithNestedPathOnMixedTypes { @Codable @MemberInit @@ -758,7 +768,7 @@ struct CodedInTests { let value3: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -837,6 +847,7 @@ struct CodedInTests { } } + @Suite("Coded In - Class With Nested Path On Mixed Types") struct ClassWithNestedPathOnMixedTypes { @Codable class SomeCodable { @@ -848,7 +859,7 @@ struct CodedInTests { let value3: String! } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -920,6 +931,7 @@ struct CodedInTests { } } + @Suite("Coded In - Actor With Nested Path On Mixed Types") struct ActorWithNestedPathOnMixedTypes { #if swift(<6) @MemberInit @@ -934,7 +946,7 @@ struct CodedInTests { } #endif - @Test + @Test("expansion") func expansion() throws { #if swift(>=6) let decodablePrefix = "@preconcurrency " diff --git a/Tests/MetaCodableTests/CodingKeysGenerationTests.swift b/Tests/MetaCodableTests/CodingKeysGenerationTests.swift index 6a577e70e3..14a5786390 100644 --- a/Tests/MetaCodableTests/CodingKeysGenerationTests.swift +++ b/Tests/MetaCodableTests/CodingKeysGenerationTests.swift @@ -4,14 +4,16 @@ import Testing @testable import PluginCore +@Suite("Coding Keys Generation Tests") struct CodingKeysGenerationTests { + @Suite("Coding Keys Generation - Backtick Expression") struct BacktickExpression { @Codable struct SomeCodable { let `internal`: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -49,7 +51,7 @@ struct CodingKeysGenerationTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = SomeCodable(internal: "reserved") let encoded = try JSONEncoder().encode(original) @@ -58,7 +60,7 @@ struct CodingKeysGenerationTests { #expect(decoded.internal == "reserved") } - @Test + @Test("decoding From J S O N") func decodingFromJSON() throws { let jsonStr = """ { @@ -72,6 +74,7 @@ struct CodingKeysGenerationTests { } } + @Suite("Coding Keys Generation - Reserved Names") struct ReservedNames { @Codable struct SomeCodable { @@ -81,7 +84,7 @@ struct CodingKeysGenerationTests { let val2: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -132,7 +135,7 @@ struct CodingKeysGenerationTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = SomeCodable(val1: "first", val2: "second") let encoded = try JSONEncoder().encode(original) @@ -142,7 +145,7 @@ struct CodingKeysGenerationTests { #expect(decoded.val2 == "second") } - @Test + @Test("decoding From J S O N") func decodingFromJSON() throws { let jsonStr = """ { @@ -162,6 +165,7 @@ struct CodingKeysGenerationTests { } } + @Suite("Coding Keys Generation - Names Beginning With Number") struct NamesBeginningWithNumber { @Codable struct SomeCodable { @@ -169,7 +173,7 @@ struct CodingKeysGenerationTests { let val: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -212,6 +216,7 @@ struct CodingKeysGenerationTests { } } + @Suite("Coding Keys Generation - Nested Properties In Same Container") struct NestedPropertiesInSameContainer { @Codable struct SomeCodable { @@ -223,7 +228,7 @@ struct CodingKeysGenerationTests { let val3: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodingKeysTests.swift b/Tests/MetaCodableTests/CodingKeysTests.swift index c84dfcb04e..e425fed378 100644 --- a/Tests/MetaCodableTests/CodingKeysTests.swift +++ b/Tests/MetaCodableTests/CodingKeysTests.swift @@ -3,8 +3,9 @@ import Testing @testable import PluginCore +@Suite("Coding Keys Tests") struct CodingKeysTests { - @Test + @Test("misuse In Absence Of Codable") func misuseInAbsenceOfCodable() throws { assertMacroExpansion( """ @@ -39,7 +40,7 @@ struct CodingKeysTests { ) } - @Test + @Test("misuse On Duplication Absence Of Codable") func misuseOnDuplicationAbsenceOfCodable() throws { assertMacroExpansion( """ @@ -113,6 +114,7 @@ struct CodingKeysTests { ) } + @Suite("Coding Keys - Came Case To Pascal Case") struct CameCaseToPascalCase { @Codable @CodingKeys(.PascalCase) @@ -122,7 +124,7 @@ struct CodingKeysTests { let description: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -172,6 +174,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Came Case To Snake Case") struct CameCaseToSnakeCase { @Codable @CodingKeys(.snake_case) @@ -181,7 +184,7 @@ struct CodingKeysTests { let description: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -231,6 +234,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Class Came Case To Snake Case") struct ClassCameCaseToSnakeCase { @Codable @CodingKeys(.snake_case) @@ -240,7 +244,7 @@ struct CodingKeysTests { let description: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -290,6 +294,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Enum Came Case To Snake Case") struct EnumCameCaseToSnakeCase { @Codable @CodingKeys(.snake_case) @@ -303,7 +308,7 @@ struct CodingKeysTests { case multi(_ variable: Bool, val: Int, String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -415,6 +420,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Came Case To Camel Snake Case") struct CameCaseToCamelSnakeCase { @Codable @CodingKeys(.camel_Snake_Case) @@ -424,7 +430,7 @@ struct CodingKeysTests { let description: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -474,6 +480,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Came Case To Screaming Snake Case") struct CameCaseToScreamingSnakeCase { @Codable @CodingKeys(.SCREAMING_SNAKE_CASE) @@ -483,7 +490,7 @@ struct CodingKeysTests { let description: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -533,6 +540,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Came Case To Kebab Case") struct CameCaseToKebabCase { @Codable @CodingKeys(.kebab-case) @@ -542,7 +550,7 @@ struct CodingKeysTests { let description: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -592,6 +600,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Came Case To Screaming Kebab Case") struct CameCaseToScreamingKebabCase { @Codable @CodingKeys(.SCREAMING-KEBAB-CASE) @@ -601,7 +610,7 @@ struct CodingKeysTests { let description: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -651,6 +660,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Came Case To Train Case") struct CameCaseToTrainCase { @Codable @CodingKeys(.Train-Case) @@ -660,7 +670,7 @@ struct CodingKeysTests { let description: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -710,6 +720,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Snake Case To Came Case") struct SnakeCaseToCameCase { @Codable @CodingKeys(.camelCase) @@ -719,7 +730,7 @@ struct CodingKeysTests { let description: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -769,6 +780,7 @@ struct CodingKeysTests { } } + @Suite("Coding Keys - Enum Cases Support") struct EnumCasesSupport { @Codable enum SomeEnum { @@ -783,7 +795,7 @@ struct CodingKeysTests { case multi(_ variable: Bool, val: Int, String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/ConditionalCoderTests.swift b/Tests/MetaCodableTests/ConditionalCoderTests.swift index 0af00f959b..afb277dd8c 100644 --- a/Tests/MetaCodableTests/ConditionalCoderTests.swift +++ b/Tests/MetaCodableTests/ConditionalCoderTests.swift @@ -7,7 +7,7 @@ import Testing /// /// These tests verify the conditional encoding/decoding paths where /// separate coders are used for decoding and encoding operations. -@Suite("ConditionalCoder Tests") +@Suite("Conditional Coder Tests") struct ConditionalCoderTests { /// A decoder-only coder that prefixes decoded strings. diff --git a/Tests/MetaCodableTests/ConformCodableTests.swift b/Tests/MetaCodableTests/ConformCodableTests.swift index d8cd483a91..f941cf9e79 100644 --- a/Tests/MetaCodableTests/ConformCodableTests.swift +++ b/Tests/MetaCodableTests/ConformCodableTests.swift @@ -9,8 +9,9 @@ import Testing @testable import PluginCore +@Suite("Conform Encodable Tests") struct ConformEncodableTests { - @Test + @Test("misuse With Codable") func misuseWithCodable() throws { assertMacroExpansion( """ @@ -51,7 +52,7 @@ struct ConformEncodableTests { ) } - @Test + @Test("misuse With Decodable") func misuseWithDecodable() throws { assertMacroExpansion( """ @@ -92,6 +93,7 @@ struct ConformEncodableTests { ) } + @Suite("Conform Encodable - Without Common Strategies") struct WithoutCommonStrategies { @ConformEncodable struct SomeEncodable { @@ -99,7 +101,7 @@ struct ConformEncodableTests { let count: Int } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -135,6 +137,7 @@ struct ConformEncodableTests { } } + @Suite("Conform Encodable - Common Strategies") struct WithCommonStrategies { @ConformEncodable(commonStrategies: [.codedBy(.valueCoder())]) struct Model { @@ -144,7 +147,7 @@ struct ConformEncodableTests { let string: String } - @Test + @Test("test Parsing") func testParsing() throws { let model = Model( bool: true, int: 42, double: 3.1416, string: "5265762156") @@ -166,7 +169,7 @@ struct ConformEncodableTests { #expect(reDecoded["string"] as? String == "5265762156") } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -210,6 +213,7 @@ struct ConformEncodableTests { } } + @Suite("Conform Encodable - With Custom Coding Keys") struct WithCustomCodingKeys { @ConformEncodable struct SomeEncodable { @@ -220,7 +224,7 @@ struct ConformEncodableTests { let count: Int } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -263,7 +267,9 @@ struct ConformEncodableTests { } } +@Suite("Conform Encodable - Conform Decodable") struct ConformDecodableTests { + @Suite("Conform Encodable - Without Common Strategies") struct WithoutCommonStrategies { @ConformDecodable struct SomeDecodable { @@ -271,7 +277,7 @@ struct ConformDecodableTests { let count: Int } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -306,7 +312,7 @@ struct ConformDecodableTests { ) } - @Test + @Test("decoding Only") func decodingOnly() throws { // Since SomeDecodable only conforms to Decodable, we can only test decoding let jsonStr = """ @@ -322,7 +328,7 @@ struct ConformDecodableTests { #expect(decoded.count == 42) } - @Test + @Test("decoding From J S O N") func decodingFromJSON() throws { let jsonStr = """ { @@ -338,6 +344,7 @@ struct ConformDecodableTests { } } + @Suite("Conform Encodable - Common Strategies") struct WithCommonStrategies { @ConformDecodable(commonStrategies: [.codedBy(.valueCoder())]) struct Model { @@ -347,7 +354,7 @@ struct ConformDecodableTests { let string: String } - @Test + @Test("test Parsing") func testParsing() throws { let json = """ { @@ -368,7 +375,7 @@ struct ConformDecodableTests { #expect(model.string == "5265762156") } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -412,6 +419,7 @@ struct ConformDecodableTests { } } + @Suite("Conform Encodable - With Custom Coding Keys") struct WithCustomCodingKeys { @ConformEncodable struct SomeEncodable { @@ -422,7 +430,7 @@ struct ConformDecodableTests { let count: Int } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/ContentAtTests.swift b/Tests/MetaCodableTests/ContentAtTests.swift index 44f9689483..92206154ec 100644 --- a/Tests/MetaCodableTests/ContentAtTests.swift +++ b/Tests/MetaCodableTests/ContentAtTests.swift @@ -5,8 +5,9 @@ import Testing @testable import PluginCore +@Suite("Content At Tests") struct ContentAtTests { - @Test + @Test("misuse On Non Enum Declaration") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -46,6 +47,7 @@ struct ContentAtTests { ) } + @Suite("Content At - Without Explicit Type") struct WithoutExplicitType { @Codable @CodedAt("type") @@ -55,7 +57,7 @@ struct ContentAtTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -145,7 +147,7 @@ struct ContentAtTests { ) } - @Test + @Test("content At Encoding Structure") func contentAtEncodingStructure() throws { let loadCommand: Command = .load(key: "test_key") let encoded = try JSONEncoder().encode(loadCommand) @@ -158,7 +160,7 @@ struct ContentAtTests { #expect(content["key"] as? String == "test_key") } - @Test + @Test("content At From J S O N") func contentAtFromJSON() throws { // The decoding expects key/value at root level, not in content let jsonStr = """ @@ -179,7 +181,7 @@ struct ContentAtTests { } } - @Test + @Test("content At J S O N Structure") func contentAtJSONStructure() throws { let storeCommand: Command = .store(key: "test", value: 100) let encoded = try JSONEncoder().encode(storeCommand) @@ -194,6 +196,7 @@ struct ContentAtTests { } } + @Suite("Content At - Explicit") struct WithExplicitType { @Codable @CodedAt("type") @@ -206,7 +209,7 @@ struct ContentAtTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -294,6 +297,7 @@ struct ContentAtTests { } } + @Suite("Content At - With Helper Expression") struct WithHelperExpression { @Codable @CodedAt("type") @@ -307,7 +311,7 @@ struct ContentAtTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift b/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift index 3cff450419..4526cfc61d 100644 --- a/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift +++ b/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift @@ -5,6 +5,7 @@ import Testing @testable import PluginCore +@Suite("Decoded At Encoded At Integration Tests") struct DecodedAtEncodedAtIntegrationTests { @Codable struct Person { @@ -17,7 +18,7 @@ struct DecodedAtEncodedAtIntegrationTests { let age: Int } - @Test + @Test("different Paths For Decoding And Encoding") func differentPathsForDecodingAndEncoding() throws { // Sample JSON with nested structure for decoding let jsonData = """ @@ -66,7 +67,7 @@ struct DecodedAtEncodedAtIntegrationTests { let createdAt: String } - @Test + @Test("complex Nested Structure") func complexNestedStructure() throws { // Complex nested JSON for decoding let jsonData = """ @@ -118,7 +119,7 @@ struct DecodedAtEncodedAtIntegrationTests { let value: Int? } - @Test + @Test("optional Values") func optionalValues() throws { // JSON with all values present let fullJsonData = """ @@ -174,8 +175,9 @@ struct DecodedAtEncodedAtIntegrationTests { #expect(partialEncodedJson["info"] == nil) } + @Suite("Decoded At Encoded At Integration - Enum") struct EnumTests { - @Test + @Test("misuse On Non Enum Declaration") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -220,7 +222,7 @@ struct DecodedAtEncodedAtIntegrationTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -365,6 +367,7 @@ struct DecodedAtEncodedAtIntegrationTests { ) } + @Suite("Decoded At Encoded At Integration - Without Explicit Type") struct WithoutExplicitType { @Codable @DecodedAt("type") @@ -374,7 +377,7 @@ struct DecodedAtEncodedAtIntegrationTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -467,6 +470,7 @@ struct DecodedAtEncodedAtIntegrationTests { } } + @Suite("Decoded At Encoded At Integration - Explicit") struct WithExplicitType { @Codable @DecodedAt("type") @@ -479,7 +483,7 @@ struct DecodedAtEncodedAtIntegrationTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -565,6 +569,7 @@ struct DecodedAtEncodedAtIntegrationTests { } } + @Suite("Decoded At Encoded At Integration - With Helper Expression") struct WithHelperExpression { @Codable @DecodedAt("type") @@ -578,7 +583,7 @@ struct DecodedAtEncodedAtIntegrationTests { case store(key: String, value: Int) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -665,6 +670,7 @@ struct DecodedAtEncodedAtIntegrationTests { } } + @Suite("Decoded At Encoded At Integration - With Nested Optional Identifier") struct WithNestedOptionalIdentifier { @Codable @CodedAs @@ -695,7 +701,7 @@ struct DecodedAtEncodedAtIntegrationTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift index 77e7061c0c..3593d3447d 100644 --- a/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift +++ b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift @@ -8,7 +8,7 @@ import Testing /// /// These tests verify the optional encoding/decoding paths for the default /// sequence element coding implementation used in sequence coders. -@Suite("DefaultSequenceElementCoding Tests") +@Suite("Default Sequence Element Coding Tests") struct DefaultSequenceElementCodingTests { /// Wrapper for decoding tests with keyed container. diff --git a/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift b/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift index 4dc3276fde..713ce5710e 100644 --- a/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift +++ b/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift @@ -2,8 +2,9 @@ import Foundation import MetaCodable import Testing +@Suite("Dynamic Codable Tests") struct DynamicCodableTests { - @Test + @Test("page With Ext Post") func pageWithExtPost() throws { let page = try JSONDecoder().decode( PageWithExtPosts.self, from: dataPageWithExtPosts @@ -26,7 +27,7 @@ struct DynamicCodableTests { } } - @Test + @Test("page With Int Post") func pageWithIntPost() throws { let page = try JSONDecoder().decode( PageWithIntPosts.self, from: dataPageWithIntPosts @@ -49,7 +50,7 @@ struct DynamicCodableTests { } } - @Test + @Test("page With Adj Post") func pageWithAdjPost() throws { let page = try JSONDecoder().decode( PageWithAdjPosts.self, from: dataPageWithAdjPosts @@ -72,7 +73,7 @@ struct DynamicCodableTests { } } - @Test + @Test("response") func response() throws { let rResponse = try JSONDecoder().decode( Response.self, from: registrationResponseAttributesData diff --git a/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift index 034f41e625..aee9ab3238 100644 --- a/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift +++ b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift @@ -6,7 +6,7 @@ import Testing /// /// These tests verify the CodingKey protocol implementation for /// DynamicCodableIdentifier, including integer and string initialization. -@Suite("DynamicCodableIdentifier CodingKey Tests") +@Suite("Dynamic Codable Identifier Tests") struct DynamicCodableIdentifierTests { // MARK: - init(intValue:) Tests diff --git a/Tests/MetaCodableTests/ExplicitCodingTests.swift b/Tests/MetaCodableTests/ExplicitCodingTests.swift index 75e23a6eff..eaa65d51c4 100644 --- a/Tests/MetaCodableTests/ExplicitCodingTests.swift +++ b/Tests/MetaCodableTests/ExplicitCodingTests.swift @@ -4,7 +4,9 @@ import Testing @testable import PluginCore +@Suite("Explicit Coding Tests") struct ExplicitCodingTests { + @Suite("Explicit Coding - Getter Only Variable") struct GetterOnlyVariable { @Codable struct SomeCodable { @@ -12,7 +14,7 @@ struct ExplicitCodingTests { var value: String { "some" } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -49,7 +51,7 @@ struct ExplicitCodingTests { ) } - @Test + @Test("encoding Only") func encodingOnly() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -59,7 +61,7 @@ struct ExplicitCodingTests { #expect(json["value"] as? String == "some") } - @Test + @Test("decoding Empty") func decodingEmpty() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -69,6 +71,7 @@ struct ExplicitCodingTests { } } + @Suite("Explicit Coding - Explicit Getter Only Variable") struct ExplicitGetterOnlyVariable { @Codable struct SomeCodable { @@ -78,7 +81,7 @@ struct ExplicitCodingTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -123,7 +126,7 @@ struct ExplicitCodingTests { ) } - @Test + @Test("encoding Only") func encodingOnly() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -133,7 +136,7 @@ struct ExplicitCodingTests { #expect(json["value"] as? String == "some") } - @Test + @Test("decoding Empty") func decodingEmpty() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -143,6 +146,7 @@ struct ExplicitCodingTests { } } + @Suite("Explicit Coding - Getter Only Variable With Multi Line Statements") struct GetterOnlyVariableWithMultiLineStatements { @Codable struct SomeCodable { @@ -153,7 +157,7 @@ struct ExplicitCodingTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -196,7 +200,7 @@ struct ExplicitCodingTests { ) } - @Test + @Test("encoding Only") func encodingOnly() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -206,7 +210,7 @@ struct ExplicitCodingTests { #expect(json["value"] as? String == "someVal") } - @Test + @Test("decoding Empty") func decodingEmpty() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -216,6 +220,7 @@ struct ExplicitCodingTests { } } + @Suite("Explicit Coding - Class Getter Only Variable With Multi Line Statements") struct ClassGetterOnlyVariableWithMultiLineStatements { @Codable class SomeCodable { @@ -226,7 +231,7 @@ struct ExplicitCodingTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -270,6 +275,7 @@ struct ExplicitCodingTests { } } + @Suite("Explicit Coding - Computed Property") struct ComputedProperty { @Codable struct SomeCodable { @@ -283,7 +289,7 @@ struct ExplicitCodingTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GenericsTests.swift b/Tests/MetaCodableTests/GenericsTests.swift index 9dad87247d..32533e8f57 100644 --- a/Tests/MetaCodableTests/GenericsTests.swift +++ b/Tests/MetaCodableTests/GenericsTests.swift @@ -4,14 +4,16 @@ import Testing @testable import PluginCore +@Suite("Generics Tests") struct GenericsTests { + @Suite("Generics - Single Generic Type Expansion") struct SingleGenericTypeExpansion { @Codable struct GenericCodable { let value: T } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -49,7 +51,7 @@ struct GenericsTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = GenericCodable(value: "test") let encoded = try JSONEncoder().encode(original) @@ -58,7 +60,7 @@ struct GenericsTests { #expect(decoded.value == "test") } - @Test + @Test("decoding And Encoding With Int") func decodingAndEncodingWithInt() throws { let original = GenericCodable(value: 42) let encoded = try JSONEncoder().encode(original) @@ -67,7 +69,7 @@ struct GenericsTests { #expect(decoded.value == 42) } - @Test + @Test("decoding From J S O N") func decodingFromJSON() throws { let jsonStr = """ { @@ -81,6 +83,7 @@ struct GenericsTests { } } + @Suite("Generics - Multiple Generic Type Expansion") struct MultipleGenericTypeExpansion { @Codable struct GenericCodable { @@ -89,7 +92,7 @@ struct GenericsTests { let value3: V } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -137,7 +140,7 @@ struct GenericsTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = GenericCodable( value1: "test", value2: 42, value3: true) @@ -149,7 +152,7 @@ struct GenericsTests { #expect(decoded.value3 == true) } - @Test + @Test("decoding From J S O N") func decodingFromJSON() throws { let jsonStr = """ { @@ -167,6 +170,7 @@ struct GenericsTests { } } + @Suite("Generics - Enum Multiple Generic Type Expansion") struct EnumMultipleGenericTypeExpansion { @Codable enum GenericCodable { @@ -175,7 +179,7 @@ struct GenericsTests { case three(V) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -255,7 +259,7 @@ struct GenericsTests { ) } - @Test + @Test("decoding And Encoding Case One") func decodingAndEncodingCaseOne() throws { let original: GenericCodable = .one("test") let encoded = try JSONEncoder().encode(original) @@ -268,7 +272,7 @@ struct GenericsTests { } } - @Test + @Test("decoding And Encoding Case Two") func decodingAndEncodingCaseTwo() throws { let original: GenericCodable = .two(42) let encoded = try JSONEncoder().encode(original) @@ -281,7 +285,7 @@ struct GenericsTests { } } - @Test + @Test("decoding From J S O N") func decodingFromJSON() throws { let jsonStr = """ { @@ -299,6 +303,7 @@ struct GenericsTests { } } + @Suite("Generics - Mixed Generic Type Expansion") struct MixedGenericTypeExpansion { @Codable struct GenericCodable { @@ -306,7 +311,7 @@ struct GenericsTests { let str: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -350,6 +355,7 @@ struct GenericsTests { } } + @Suite("Generics - Class Mixed Generic Type Expansion") struct ClassMixedGenericTypeExpansion { @Codable class GenericCodable { @@ -357,7 +363,7 @@ struct GenericsTests { let str: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -401,6 +407,7 @@ struct GenericsTests { } } + @Suite("Generics - Enum Mixed Generic Type Expansion") struct EnumMixedGenericTypeExpansion { @Codable enum GenericCodable { @@ -409,7 +416,7 @@ struct GenericsTests { case two(String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -478,6 +485,7 @@ struct GenericsTests { } } + @Suite("Generics - Ignored Generic Type Expansion") struct IgnoredGenericTypeExpansion { @Codable struct GenericCodable { @@ -485,7 +493,7 @@ struct GenericsTests { let str: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -526,6 +534,7 @@ struct GenericsTests { } } + @Suite("Generics - Helper Coded Generic Type Expansion") struct HelperCodedGenericTypeExpansion { @Codable struct GenericCodable { @@ -534,7 +543,7 @@ struct GenericsTests { let str: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -579,6 +588,7 @@ struct GenericsTests { } } + @Suite("Generics - Ignored Encoding Generic Type Expansion") struct IgnoredEncodingGenericTypeExpansion { @Codable struct GenericCodable { @@ -587,7 +597,7 @@ struct GenericsTests { let str: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -631,6 +641,7 @@ struct GenericsTests { } } + @Suite("Generics - Class Ignored Encoding Generic Type Expansion") struct ClassIgnoredEncodingGenericTypeExpansion { @Codable class GenericCodable { @@ -639,7 +650,7 @@ struct GenericsTests { let str: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -683,6 +694,7 @@ struct GenericsTests { } } + @Suite("Generics - Enum Ignored Encoding Generic Type Expansion") struct EnumIgnoredEncodingGenericTypeExpansion { @Codable enum GenericCodable { @@ -691,7 +703,7 @@ struct GenericsTests { case two(String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GroupedMutableVariableTests.swift b/Tests/MetaCodableTests/GroupedMutableVariableTests.swift index 06d16efb10..882e51d88e 100644 --- a/Tests/MetaCodableTests/GroupedMutableVariableTests.swift +++ b/Tests/MetaCodableTests/GroupedMutableVariableTests.swift @@ -3,7 +3,9 @@ import Testing @testable import PluginCore +@Suite("Grouped Mutable Variable Tests") struct GroupedMutableVariableTests { + @Suite("Grouped Mutable Variable - No Customization") struct WithoutAnyCustomization { @Codable @MemberInit @@ -11,7 +13,7 @@ struct GroupedMutableVariableTests { var one, two, three: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -63,6 +65,7 @@ struct GroupedMutableVariableTests { } } + @Suite("Grouped Mutable Variable - Explicit") struct WithSomeInitializedWithExplicitTyping { @Codable @MemberInit @@ -70,7 +73,7 @@ struct GroupedMutableVariableTests { var one, two: String, three: String = "" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -127,6 +130,7 @@ struct GroupedMutableVariableTests { } } + @Suite("Grouped Mutable Variable - Mixed Types") struct MixedTypes { @Codable @MemberInit @@ -134,7 +138,7 @@ struct GroupedMutableVariableTests { var one, two: String, three: Int } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -228,6 +232,7 @@ struct GroupedMutableVariableTests { // ) // } + @Suite("Grouped Mutable Variable - Explicit") struct MixedTypesWithSomeInitializedWithExplicitTyping { @Codable @MemberInit @@ -235,7 +240,7 @@ struct GroupedMutableVariableTests { var one: String, two: String = "", three: Int } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -292,7 +297,7 @@ struct GroupedMutableVariableTests { } } - @Test + @Test("mixed Types With Some Initialized Without Explicit Typing") func mixedTypesWithSomeInitializedWithoutExplicitTyping() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GroupedVariableTests.swift b/Tests/MetaCodableTests/GroupedVariableTests.swift index 22ac43d62c..44e08d9423 100644 --- a/Tests/MetaCodableTests/GroupedVariableTests.swift +++ b/Tests/MetaCodableTests/GroupedVariableTests.swift @@ -4,7 +4,9 @@ import Testing @testable import PluginCore +@Suite("Grouped Variable Tests") struct GroupedVariableTests { + @Suite("Grouped Variable - No Customization") struct WithoutAnyCustomization { @Codable @MemberInit @@ -12,7 +14,7 @@ struct GroupedVariableTests { let one, two, three: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -63,7 +65,7 @@ struct GroupedVariableTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = SomeCodable( one: "first", two: "second", three: "third") @@ -75,7 +77,7 @@ struct GroupedVariableTests { #expect(decoded.three == "third") } - @Test + @Test("decoding From J S O N") func decodingFromJSON() throws { let jsonStr = """ { @@ -92,7 +94,7 @@ struct GroupedVariableTests { #expect(decoded.three == "value3") } - @Test + @Test("encoding To J S O N") func encodingToJSON() throws { let original = SomeCodable(one: "a", two: "b", three: "c") let encoded = try JSONEncoder().encode(original) @@ -105,6 +107,7 @@ struct GroupedVariableTests { } } + @Suite("Grouped Variable - Explicit") struct WithSomeInitializedWithExplicitTyping { @Codable @MemberInit @@ -112,7 +115,7 @@ struct GroupedVariableTests { let one, two: String, three: String = "" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -162,6 +165,7 @@ struct GroupedVariableTests { } } + @Suite("Grouped Variable - Mixed Types") struct MixedTypes { @Codable @MemberInit @@ -169,7 +173,7 @@ struct GroupedVariableTests { let one, two: String, three: Int } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -259,6 +263,7 @@ struct GroupedVariableTests { // ) // } + @Suite("Grouped Variable - Explicit") struct MixedTypesWithSomeInitializedWithExplicitTyping { @Codable @MemberInit @@ -266,7 +271,7 @@ struct GroupedVariableTests { let one: String, two: String = "", three: Int } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -316,6 +321,7 @@ struct GroupedVariableTests { } } + @Suite("Grouped Variable - Mixed Types With Some Initialized Without Explicit Typing") struct MixedTypesWithSomeInitializedWithoutExplicitTyping { @Codable @MemberInit @@ -323,7 +329,7 @@ struct GroupedVariableTests { let one: String, two = "", three: Int } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/HelperCoderTests.swift b/Tests/MetaCodableTests/HelperCoderTests.swift index 2520900fec..86c7a483a1 100644 --- a/Tests/MetaCodableTests/HelperCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoderTests.swift @@ -6,7 +6,7 @@ import Testing /// /// These tests verify the optional encoding/decoding paths that have /// default implementations in the `HelperCoder` protocol extension. -@Suite("HelperCoder Protocol Tests") +@Suite("Helper Coder Tests") struct HelperCoderTests { /// A simple helper coder for testing that wraps String values. diff --git a/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift index 7b2fc9c922..9647ce0b1d 100644 --- a/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift @@ -3,8 +3,9 @@ import HelperCoders import MetaCodable import Testing +@Suite("Data Coder Tests") struct DataCoderTests { - @Test + @Test("decoding") func decoding() throws { let jsonStr = """ { @@ -19,7 +20,7 @@ struct DataCoderTests { #expect(newModel == model) } - @Test + @Test("invalid Data Decoding") func invalidDataDecoding() throws { let jsonStr = """ { diff --git a/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift index c6b80a50d3..b16c6854d3 100644 --- a/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift @@ -3,8 +3,9 @@ import HelperCoders import MetaCodable import Testing +@Suite("Date Coder Tests") struct DateCoderTests { - @Test + @Test("decoding") func decoding() throws { let jsonStr = """ { @@ -30,7 +31,7 @@ struct DateCoderTests { #expect(newModel == model) } - @Test + @Test("invalid Decoding") func invalidDecoding() throws { let jsonStr = """ { diff --git a/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift b/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift index f6e434d4be..8c240dd26b 100644 --- a/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift @@ -3,8 +3,9 @@ import HelperCoders import MetaCodable import Testing +@Suite("Helper Coders Tests") struct HelperCodersTests { - @Test + @Test("conditional And Optional Coding") func conditionalAndOptionalCoding() throws { let jsonStr = """ { @@ -24,7 +25,7 @@ struct HelperCodersTests { #expect(model.optionalDate == nil) } - @Test + @Test("property Wrapper Coding") func propertyWrapperCoding() throws { let jsonStr = """ { diff --git a/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift b/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift index 5002fae18f..864bb25777 100644 --- a/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift @@ -2,8 +2,10 @@ import Foundation import MetaCodable import Testing +@Suite("Lossy Sequence Tests") struct LossySequenceTests { - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("invalid Data Type") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func invalidDataType() throws { #expect(throws: DecodingError.self) { @@ -12,7 +14,8 @@ struct LossySequenceTests { } } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("empty Data") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func emptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! @@ -20,7 +23,8 @@ struct LossySequenceTests { #expect(val.data == []) } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("valid Data") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func validData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! @@ -30,7 +34,8 @@ struct LossySequenceTests { #expect(data == json) } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("invalid Data") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func invalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -38,7 +43,8 @@ struct LossySequenceTests { #expect(val.data == ["1", "2"]) } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("optional Invalid Data Type") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalInvalidDataType() throws { #expect(throws: DecodingError.self) { @@ -49,7 +55,8 @@ struct LossySequenceTests { } } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("optional Empty Data") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalEmptyData() throws { let json = "{}".data(using: .utf8)! @@ -57,7 +64,8 @@ struct LossySequenceTests { #expect(val.data == nil) } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("optional Valid Data") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! @@ -67,7 +75,8 @@ struct LossySequenceTests { #expect(data == json) } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("optional Invalid Data") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -75,7 +84,8 @@ struct LossySequenceTests { #expect(val.data == ["1", "2"]) } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("default Invalid Data Type") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultInvalidDataType() throws { let json = #"{"data":1}"#.data(using: .utf8)! @@ -83,7 +93,8 @@ struct LossySequenceTests { #expect(val.data == ["some"]) } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("default Empty Data") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! @@ -91,7 +102,8 @@ struct LossySequenceTests { #expect(val.data == []) } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("default Valid Data") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! @@ -101,7 +113,8 @@ struct LossySequenceTests { #expect(data == json) } - @Test + @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") + @Test("default Invalid Data") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! diff --git a/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift index 114b7e87e4..940ea94023 100644 --- a/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift @@ -3,8 +3,9 @@ import HelperCoders import MetaCodable import Testing +@Suite("Non Conforming Coder Tests") struct NonConformingCoderTests { - @Test + @Test("test Decoding Actual Float") func testDecodingActualFloat() throws { let json = try mockJSON(5.5) let model = try JSONDecoder().decode(Model.self, from: json) @@ -14,7 +15,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == 5.5) } - @Test + @Test("test Decoding Stringified Float") func testDecodingStringifiedFloat() throws { let json = try mockJSON("5.5") let model = try JSONDecoder().decode(Model.self, from: json) @@ -24,7 +25,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == 5.5) } - @Test + @Test("test Decoding Positive Infinity") func testDecodingPositiveInfinity() throws { let json = try mockJSON("➕♾️") let model = try JSONDecoder().decode(Model.self, from: json) @@ -34,7 +35,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == .infinity) } - @Test + @Test("test Decoding Negative Infinity") func testDecodingNegativeInfinity() throws { let json = try mockJSON("➖♾️") let model = try JSONDecoder().decode(Model.self, from: json) @@ -44,7 +45,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == -.infinity) } - @Test + @Test("test Decoding Not A Number") func testDecodingNotANumber() throws { let json = try mockJSON("😞") let model = try JSONDecoder().decode(Model.self, from: json) @@ -54,7 +55,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float.isNaN) } - @Test + @Test("invalid Decoding") func invalidDecoding() throws { let json = try mockJSON("random") #expect(throws: DecodingError.self) { diff --git a/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift index 0366190806..9902394c9b 100644 --- a/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift @@ -3,11 +3,12 @@ import HelperCoders import MetaCodable import Testing +@Suite("Sequence Coder Tests") struct SequenceCoderTests { let decoder = JSONDecoder() let encoder = JSONEncoder() - @Test + @Test("invalid Data Type") func invalidDataType() throws { #expect(throws: DecodingError.self) { let json = #"{"data":1}"#.data(using: .utf8)! @@ -15,14 +16,14 @@ struct SequenceCoderTests { } } - @Test + @Test("empty Data") func emptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(Container.self, from: json) #expect(val.data.isEmpty) } - @Test + @Test("valid Data") func validData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(Container.self, from: json) @@ -31,7 +32,7 @@ struct SequenceCoderTests { #expect(data == json) } - @Test + @Test("invalid Data") func invalidData() throws { #expect(throws: DecodingError.self) { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -39,7 +40,7 @@ struct SequenceCoderTests { } } - @Test + @Test("lossy Invalid Data Type") func lossyInvalidDataType() throws { #expect(throws: DecodingError.self) { let json = #"{"data":1}"#.data(using: .utf8)! @@ -47,14 +48,14 @@ struct SequenceCoderTests { } } - @Test + @Test("lossy Empty Data") func lossyEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(LossyContainer.self, from: json) #expect(val.data.isEmpty) } - @Test + @Test("lossy Valid Data") func lossyValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyContainer.self, from: json) @@ -63,28 +64,28 @@ struct SequenceCoderTests { #expect(data == json) } - @Test + @Test("lossy Invalid Data") func lossyInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyContainer.self, from: json) #expect(val.data == ["1", "2"]) } - @Test + @Test("default Invalid Data Type") func defaultInvalidDataType() throws { let json = #"{"data":1}"#.data(using: .utf8)! let val = try decoder.decode(DefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test + @Test("default Empty Data") func defaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(DefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test + @Test("default Valid Data") func defaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(DefaultContainer.self, from: json) @@ -93,7 +94,7 @@ struct SequenceCoderTests { #expect(data == json) } - @Test + @Test("default Invalid Data") func defaultInvalidData() throws { #expect(throws: DecodingError.self) { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -101,21 +102,21 @@ struct SequenceCoderTests { } } - @Test + @Test("lossy Default Invalid Data Type") func lossyDefaultInvalidDataType() throws { let json = #"{"data":1}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test + @Test("lossy Default Empty Data") func lossyDefaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test + @Test("lossy Default Valid Data") func lossyDefaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) @@ -124,7 +125,7 @@ struct SequenceCoderTests { #expect(data == json) } - @Test + @Test("lossy Default Invalid Data") func lossyDefaultInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) diff --git a/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift index 7d0894adcc..bf065daf89 100644 --- a/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift @@ -3,8 +3,9 @@ import HelperCoders import MetaCodable import Testing +@Suite("Value Coder Tests") struct ValueCoderTests { - @Test + @Test("actual Type Decoding") func actualTypeDecoding() throws { let json = try mockJSON(true, 5, 5.5, "some") let model = try JSONDecoder().decode(Model.self, from: json) @@ -21,7 +22,7 @@ struct ValueCoderTests { } // MARK: Bool - @Test + @Test("int To Boolean Decoding") func intToBooleanDecoding() throws { let json1 = try mockJSON(1, 5, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -31,7 +32,7 @@ struct ValueCoderTests { #expect(!model2.bool) } - @Test + @Test("int To Boolean Decoding Failure") func intToBooleanDecodingFailure() throws { #expect(throws: DecodingError.self) { let json = try mockJSON(2, 5, 5.5, "some") @@ -39,7 +40,7 @@ struct ValueCoderTests { } } - @Test + @Test("float To Boolean Decoding") func floatToBooleanDecoding() throws { let json1 = try mockJSON(1.0, 5, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -49,7 +50,7 @@ struct ValueCoderTests { #expect(!model2.bool) } - @Test + @Test("float To Boolean Decoding Failure") func floatToBooleanDecodingFailure() throws { #expect(throws: DecodingError.self) { let json = try mockJSON(1.1, 5, 5.5, "some") @@ -80,7 +81,7 @@ struct ValueCoderTests { } // MARK: Int - @Test + @Test("bool To Int Decoding") func boolToIntDecoding() throws { let json1 = try mockJSON(true, true, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -90,7 +91,7 @@ struct ValueCoderTests { #expect(model2.int == 0) } - @Test + @Test("float To Int Decoding") func floatToIntDecoding() throws { let json1 = try mockJSON(true, 5.0, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -100,7 +101,7 @@ struct ValueCoderTests { #expect(model2.int == 0) } - @Test + @Test("float To Int Decoding Failure") func floatToIntDecodingFailure() throws { #expect(throws: DecodingError.self) { let json = try mockJSON(true, 5.5, 5.5, "some") @@ -124,7 +125,7 @@ struct ValueCoderTests { } // MARK: Float - @Test + @Test("bool To Float Decoding") func boolToFloatDecoding() throws { let json1 = try mockJSON(true, 5, true, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -134,7 +135,7 @@ struct ValueCoderTests { #expect(model2.double == 0) } - @Test + @Test("int To Float Decoding") func intToFloatDecoding() throws { let json1 = try mockJSON(true, 5, 5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -160,7 +161,7 @@ struct ValueCoderTests { } // MARK: String - @Test + @Test("bool To String Decoding") func boolToStringDecoding() throws { let json1 = try mockJSON(true, 5, 5.5, true) let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -170,7 +171,7 @@ struct ValueCoderTests { #expect(model2.string == "false") } - @Test + @Test("int To String Decoding") func intToStringDecoding() throws { let json1 = try mockJSON(true, 5, 5.5, 5) let model1 = try JSONDecoder().decode(Model.self, from: json1) diff --git a/Tests/MetaCodableTests/IgnoreCodingTests.swift b/Tests/MetaCodableTests/IgnoreCodingTests.swift index 739b586858..954941abea 100644 --- a/Tests/MetaCodableTests/IgnoreCodingTests.swift +++ b/Tests/MetaCodableTests/IgnoreCodingTests.swift @@ -4,8 +4,9 @@ import Testing @testable import PluginCore +@Suite("Ignore Coding Tests") struct IgnoreCodingTests { - @Test + @Test("misuse On Uninitialized Variable") func misuseOnUninitializedVariable() throws { assertMacroExpansion( """ @@ -96,7 +97,7 @@ struct IgnoreCodingTests { ) } - @Test + @Test("misuse With Invalid Combination") func misuseWithInvalidCombination() throws { assertMacroExpansion( """ @@ -146,6 +147,7 @@ struct IgnoreCodingTests { ) } + @Suite("Ignore Coding - Decoding Encoding Ignore") struct DecodingEncodingIgnore { @Codable struct SomeCodable { @@ -153,7 +155,7 @@ struct IgnoreCodingTests { var one: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -182,7 +184,7 @@ struct IgnoreCodingTests { ) } - @Test + @Test("ignore Coding Behavior") func ignoreCodingBehavior() throws { let original = SomeCodable() #expect(original.one == "some") // Default value @@ -194,7 +196,7 @@ struct IgnoreCodingTests { } } - @Test + @Test("ignore Coding From J S O N") func ignoreCodingFromJSON() throws { let jsonStr = """ { @@ -208,6 +210,7 @@ struct IgnoreCodingTests { #expect(decoded.one == "some") // Should keep default value, ignore JSON } + @Suite("Ignore Coding - Optional") struct Optional { @Codable struct SomeCodable { @@ -220,7 +223,7 @@ struct IgnoreCodingTests { let four: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -267,7 +270,7 @@ struct IgnoreCodingTests { ) } - @Test + @Test("decoding") func decoding() throws { let json = try #require("{\"four\":\"som\"}".data(using: .utf8)) let obj = try JSONDecoder().decode(SomeCodable.self, from: json) @@ -277,7 +280,7 @@ struct IgnoreCodingTests { #expect(obj.four == "som") } - @Test + @Test("encoding") func encoding() throws { let obj = SomeCodable(one: "one", two: "two", four: "some") let json = try JSONEncoder().encode(obj) @@ -289,6 +292,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Enum Decoding Encoding Ignore") struct EnumDecodingEncodingIgnore { @Codable enum SomeEnum { @@ -296,7 +300,7 @@ struct IgnoreCodingTests { case bool(_ variableBool: Bool) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -331,6 +335,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Decoding Ignore") struct DecodingIgnore { @Codable struct SomeCodable { @@ -338,7 +343,7 @@ struct IgnoreCodingTests { var one: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -376,6 +381,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Enum Decoding Ignore") struct EnumDecodingIgnore { @Codable enum SomeEnum { @@ -383,7 +389,7 @@ struct IgnoreCodingTests { case bool(_ variableBool: Bool) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -432,6 +438,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Encoding Ignore") struct EncodingIgnore { @Codable struct SomeCodable { @@ -441,7 +448,7 @@ struct IgnoreCodingTests { var two: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -484,6 +491,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Encoding Ignore With Condition") struct EncodingIgnoreWithCondition { @Codable struct SomeCodable { @@ -493,7 +501,7 @@ struct IgnoreCodingTests { var two: String } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -541,7 +549,7 @@ struct IgnoreCodingTests { ) } - @Test + @Test("ignore") func ignore() throws { let obj = SomeCodable(one: "", two: "") let data = try JSONEncoder().encode(obj) @@ -551,7 +559,7 @@ struct IgnoreCodingTests { #expect(dict["two"] == nil) } - @Test + @Test("encode") func encode() throws { let obj = SomeCodable(one: "some", two: "some") let data = try JSONEncoder().encode(obj) @@ -561,7 +569,7 @@ struct IgnoreCodingTests { #expect(dict["two"] == "some") } - @Test + @Test("decode") func decode() throws { let json = "{\"one\": \"\", \"two\": \"\"}".data(using: .utf8)! let obj = try JSONDecoder().decode(SomeCodable.self, from: json) @@ -570,6 +578,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Enum Encoding Ignore") struct EnumEncodingIgnore { @Codable enum SomeEnum { @@ -577,7 +586,7 @@ struct IgnoreCodingTests { case bool(_ variableBool: Bool) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -632,6 +641,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Enum Encoding Ignore With Condition") struct EnumEncodingIgnoreWithCondition { @Codable enum SomeEnum { @@ -641,7 +651,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -747,6 +757,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Enum Encoding Ignore With Condition Combined") struct EnumEncodingIgnoreWithConditionCombined { @Codable enum SomeEnum { @@ -756,7 +767,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -847,6 +858,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Combination With Other Macros") struct CombinationWithOtherMacros { @Codable struct SomeCodable { @@ -864,7 +876,7 @@ struct IgnoreCodingTests { var four: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -927,6 +939,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Class Combination With Other Macros") struct ClassCombinationWithOtherMacros { @Codable class SomeCodable { @@ -944,7 +957,7 @@ struct IgnoreCodingTests { var four: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -1007,6 +1020,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Enum Combination With Other Macros") struct EnumCombinationWithOtherMacros { @Codable enum SomeEnum { @@ -1022,7 +1036,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -1108,6 +1122,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Encoding Ignore With Based On Condition") struct EncodingIgnoreWithBasedOnCondition { @Codable struct SomeCodable { @@ -1118,7 +1133,7 @@ struct IgnoreCodingTests { var shouldIgnoreTwo: Bool } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -1171,7 +1186,7 @@ struct IgnoreCodingTests { ) } - @Test + @Test("ignore") func ignore() throws { let obj = SomeCodable( one: "", two: "ignored", shouldIgnoreTwo: true) @@ -1183,7 +1198,7 @@ struct IgnoreCodingTests { #expect(dict["shouldIgnoreTwo"] as? Bool == true) } - @Test + @Test("encode") func encode() throws { let obj = SomeCodable( one: "some", two: "some", shouldIgnoreTwo: false) @@ -1195,7 +1210,7 @@ struct IgnoreCodingTests { #expect(dict["shouldIgnoreTwo"] as? Bool == false) } - @Test + @Test("decode") func decode() throws { let json = "{\"one\": \"\", \"two\": \"value\", \"shouldIgnoreTwo\": true}" @@ -1207,6 +1222,7 @@ struct IgnoreCodingTests { } } + @Suite("Ignore Coding - Enum Encoding Ignore With Based On Condition") struct EnumEncodingIgnoreWithBasedOnCondition { @Codable enum SomeEnum { @@ -1216,7 +1232,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/IgnoreInitializedTests.swift b/Tests/MetaCodableTests/IgnoreInitializedTests.swift index 86bb0992ad..5b7aea9c30 100644 --- a/Tests/MetaCodableTests/IgnoreInitializedTests.swift +++ b/Tests/MetaCodableTests/IgnoreInitializedTests.swift @@ -3,8 +3,9 @@ import Testing @testable import PluginCore +@Suite("Ignore Initialized Tests") struct IgnoreInitializedTests { - @Test + @Test("misuse") func misuse() throws { assertMacroExpansion( """ @@ -35,6 +36,7 @@ struct IgnoreInitializedTests { ) } + @Suite("Ignore Initialized - Ignore") struct Ignore { @Codable @IgnoreCodingInitialized @@ -42,7 +44,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -72,6 +74,7 @@ struct IgnoreInitializedTests { } } + @Suite("Ignore Initialized - Class Ignore") struct ClassIgnore { @Codable @IgnoreCodingInitialized @@ -79,7 +82,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -111,6 +114,7 @@ struct IgnoreInitializedTests { } } + @Suite("Ignore Initialized - Enum Ignore") struct EnumIgnore { @Codable @IgnoreCodingInitialized @@ -124,7 +128,7 @@ struct IgnoreInitializedTests { case multi(_ variable: Bool, val: Int, String = "text") } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -221,6 +225,7 @@ struct IgnoreInitializedTests { } } + @Suite("Ignore Initialized - Enum Case Ignore") struct EnumCaseIgnore { @Codable enum SomeEnum { @@ -234,7 +239,7 @@ struct IgnoreInitializedTests { case multi(_ variable: Bool, val: Int, String = "text") } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -334,6 +339,7 @@ struct IgnoreInitializedTests { } } + @Suite("Ignore Initialized - Explicit Coding With Ignore") struct ExplicitCodingWithIgnore { @Codable @IgnoreCodingInitialized @@ -342,7 +348,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -383,6 +389,7 @@ struct IgnoreInitializedTests { } } + @Suite("Ignore Initialized - Explicit Coding With Top And Decode Ignore") struct ExplicitCodingWithTopAndDecodeIgnore { @Codable @IgnoreCodingInitialized @@ -392,7 +399,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -432,6 +439,7 @@ struct IgnoreInitializedTests { } } + @Suite("Ignore Initialized - Explicit Coding With Top And Encode Ignore") struct ExplicitCodingWithTopAndEncodeIgnore { @Codable @IgnoreCodingInitialized @@ -441,7 +449,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/RawRepresentableEnumTests.swift b/Tests/MetaCodableTests/RawRepresentableEnumTests.swift index e6e8418d54..9fbea5b19b 100644 --- a/Tests/MetaCodableTests/RawRepresentableEnumTests.swift +++ b/Tests/MetaCodableTests/RawRepresentableEnumTests.swift @@ -6,7 +6,9 @@ import XCTest @testable import PluginCore +@Suite("Raw Representable Enum Tests") struct RawRepresentableEnumTests { + @Suite("Raw Representable Enum - String Representation") struct StringRepresentation { @Codable enum Status: String, CaseIterable { @@ -15,7 +17,7 @@ struct RawRepresentableEnumTests { case pending = "pending" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -118,7 +120,7 @@ struct RawRepresentableEnumTests { #expect(decoded == status) } - @Test + @Test("direct Decoding") func directDecoding() throws { let jsonString = "\"active\"" let jsonData = jsonString.data(using: .utf8)! @@ -130,6 +132,7 @@ struct RawRepresentableEnumTests { } } + @Suite("Raw Representable Enum - Int Representation") struct IntRepresentation { @Codable enum Priority: Int, CaseIterable { @@ -138,7 +141,7 @@ struct RawRepresentableEnumTests { case high = 3 } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -254,6 +257,7 @@ struct RawRepresentableEnumTests { } } + @Suite("Raw Representable Enum - CodedAt") struct WithCodedAt { @Codable @CodedAt("level") @@ -263,7 +267,7 @@ struct RawRepresentableEnumTests { case advanced = "advanced" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -380,6 +384,7 @@ struct RawRepresentableEnumTests { } } + @Suite("Raw Representable Enum - CodedAs") struct WithCodedAs { @Codable enum Command: String { @@ -622,7 +627,7 @@ struct RawRepresentableEnumTests { // MARK: - Error Cases - @Test + @Test("invalid Coded As Value Decoding") func invalidCodedAsValueDecoding() throws { let jsonString = "\"INVALID\"" let jsonData = jsonString.data(using: .utf8)! @@ -633,7 +638,7 @@ struct RawRepresentableEnumTests { } } - @Test + @Test("invalid Response Code Decoding") func invalidResponseCodeDecoding() throws { let jsonString = "999" // Not in any CodedAs range let jsonData = jsonString.data(using: .utf8)! @@ -646,7 +651,7 @@ struct RawRepresentableEnumTests { // MARK: - Array and Collection Tests - @Test + @Test("http Method Array Decoding") func httpMethodArrayDecoding() throws { // Test that we can decode arrays with mixed CodedAs and raw values let jsonString = """ @@ -664,7 +669,7 @@ struct RawRepresentableEnumTests { #expect(decoded == expected) } - @Test + @Test("response Code Array Decoding") func responseCodeArrayDecoding() throws { // Test decoding array of response codes with CodedAs values let jsonString = """ @@ -688,6 +693,7 @@ struct RawRepresentableEnumTests { } } + @Suite("Raw Representable Enum - CodedBy") struct WithCodedBy { @Codable @CodedBy(ValueCoder()) diff --git a/Tests/MetaCodableTests/UntaggedEnumTests.swift b/Tests/MetaCodableTests/UntaggedEnumTests.swift index c2fd8e3775..a4a6c965b5 100644 --- a/Tests/MetaCodableTests/UntaggedEnumTests.swift +++ b/Tests/MetaCodableTests/UntaggedEnumTests.swift @@ -5,8 +5,9 @@ import XCTest @testable import PluginCore +@Suite("Untagged Enum Tests") struct UntaggedEnumTests { - @Test + @Test("misuse On Non Enum Declaration") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -56,7 +57,7 @@ struct UntaggedEnumTests { ) } - @Test + @Test("misuse In Combination With Coded At Macro") func misuseInCombinationWithCodedAtMacro() throws { assertMacroExpansion( """ @@ -145,7 +146,7 @@ struct UntaggedEnumTests { ) } - @Test + @Test("duplicated Misuse") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -236,6 +237,7 @@ struct UntaggedEnumTests { ) } + @Suite("Untagged Enum - Without Fallback Case") struct WithoutFallbackCase { @Codable @UnTagged @@ -250,7 +252,7 @@ struct UntaggedEnumTests { case dictionary([String: Self]) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -373,7 +375,7 @@ struct UntaggedEnumTests { ) } - @Test + @Test("decoding And Encoding Bool") func decodingAndEncodingBool() throws { let original: CodableValue = .bool(true) let encoded = try JSONEncoder().encode(original) @@ -386,7 +388,7 @@ struct UntaggedEnumTests { } } - @Test + @Test("decoding And Encoding String") func decodingAndEncodingString() throws { let original: CodableValue = .string("test") let encoded = try JSONEncoder().encode(original) @@ -399,7 +401,7 @@ struct UntaggedEnumTests { } } - @Test + @Test("decoding From J S O N Primitives") func decodingFromJSONPrimitives() throws { // Test bool let boolJson = "true".data(using: .utf8)! @@ -432,7 +434,7 @@ struct UntaggedEnumTests { } } - @Test + @Test("decoding From J S O N Array") func decodingFromJSONArray() throws { let arrayJson = "[true, \"test\", 123]".data(using: .utf8)! let arrayDecoded = try JSONDecoder().decode( @@ -450,6 +452,7 @@ struct UntaggedEnumTests { } } + @Suite("Untagged Enum - With Fallback Case") struct WithFallbackCase { @Codable @UnTagged @@ -465,7 +468,7 @@ struct UntaggedEnumTests { case `nil` } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -588,7 +591,7 @@ struct UntaggedEnumTests { ) } - @Test + @Test("decoding") func decoding() throws { let data = try JSONDecoder().decode( CodableValue.self, from: heterogenousJSONData @@ -602,6 +605,7 @@ struct UntaggedEnumTests { } } + @Suite("Untagged Enum - Nested Decoding") struct NestedDecoding { @Codable @UnTagged @@ -613,7 +617,7 @@ struct UntaggedEnumTests { case multi(_ variable: Bool, val: Int, String) } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/VariableDeclarationTests.swift b/Tests/MetaCodableTests/VariableDeclarationTests.swift index 3e589dcf6a..ab864ebb29 100644 --- a/Tests/MetaCodableTests/VariableDeclarationTests.swift +++ b/Tests/MetaCodableTests/VariableDeclarationTests.swift @@ -4,7 +4,9 @@ import Testing @testable import PluginCore +@Suite("Variable Declaration Tests") struct VariableDeclarationTests { + @Suite("Variable Declaration - Initialized Immutable Variable") struct InitializedImmutableVariable { @Codable @MemberInit @@ -12,7 +14,7 @@ struct VariableDeclarationTests { let value: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -52,7 +54,7 @@ struct VariableDeclarationTests { ) } - @Test + @Test("decoding And Encoding") func decodingAndEncoding() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -61,7 +63,7 @@ struct VariableDeclarationTests { #expect(decoded.value == "some") } - @Test + @Test("decoding From Empty J S O N") func decodingFromEmptyJSON() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -70,7 +72,7 @@ struct VariableDeclarationTests { #expect(decoded.value == "some") } - @Test + @Test("encoding To J S O N") func encodingToJSON() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -81,6 +83,7 @@ struct VariableDeclarationTests { } } + @Suite("Variable Declaration - Initialized Mutable Variable") struct InitializedMutableVariable { @Codable @MemberInit @@ -88,7 +91,7 @@ struct VariableDeclarationTests { var value: String = "some" } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -135,6 +138,7 @@ struct VariableDeclarationTests { } } + @Suite("Variable Declaration - Getter Only Variable") struct GetterOnlyVariable { @Codable @MemberInit @@ -142,7 +146,7 @@ struct VariableDeclarationTests { var value: String { "some" } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -175,6 +179,7 @@ struct VariableDeclarationTests { } } + @Suite("Variable Declaration - Explicit Getter Only Variable") struct ExplicitGetterOnlyVariable { @Codable @MemberInit @@ -184,7 +189,7 @@ struct VariableDeclarationTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -225,6 +230,7 @@ struct VariableDeclarationTests { } } + @Suite("Variable Declaration - Getter Only Variable With Multi Line Statements") struct GetterOnlyVariableWithMultiLineStatements { @Codable @MemberInit @@ -235,7 +241,7 @@ struct VariableDeclarationTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -274,6 +280,7 @@ struct VariableDeclarationTests { } } + @Suite("Variable Declaration - Variable With Property Observers") struct VariableWithPropertyObservers { @Codable @MemberInit @@ -289,7 +296,7 @@ struct VariableDeclarationTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -353,6 +360,7 @@ struct VariableDeclarationTests { } } + @Suite("Variable Declaration - Initialized Variable With Property Observers") struct InitializedVariableWithPropertyObservers { @Codable @MemberInit @@ -368,7 +376,7 @@ struct VariableDeclarationTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -443,6 +451,7 @@ struct VariableDeclarationTests { } } + @Suite("Variable Declaration - Computed Property") struct ComputedProperty { @Codable @MemberInit @@ -456,7 +465,7 @@ struct VariableDeclarationTests { } } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -501,6 +510,7 @@ struct VariableDeclarationTests { } } + @Suite("Variable Declaration - Optional Syntax Variable") struct OptionalSyntaxVariable { @Codable @MemberInit @@ -508,7 +518,7 @@ struct VariableDeclarationTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ @@ -592,6 +602,7 @@ struct VariableDeclarationTests { } } + @Suite("Variable Declaration - Generic Syntax Optional Variable") struct GenericSyntaxOptionalVariable { @Codable @MemberInit @@ -599,7 +610,7 @@ struct VariableDeclarationTests { let value: String? } - @Test + @Test("expansion") func expansion() throws { assertMacroExpansion( """ From edeba0bbc27e37f99649b2020b20710b668a9037 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 15:37:07 +0700 Subject: [PATCH 15/29] test: improve all test names with meaningful, unique descriptions Updated all 565 tests across 50 files: - Analyzed actual test logic to generate descriptive names - Ensured all test names are unique across the entire test suite - Applied proper capitalization and English grammar - Preserved parameterized tests with arguments: - Replaced generic names like "expansion" with context-specific descriptions e.g., "Generates @Codable conformance for struct with 'open' access" - Error tests now clearly state what error they verify e.g., "Reports error when @CodingKeys is used without @Codable" Test names now immediately communicate what each test verifies, making test failures instantly understandable without needing to inspect the test code. Updated Tests/TODO/CoverageTracking.md to document the test organization improvements. --- .../AccessModifierTests.swift | 14 ++-- .../Attributes/CodedByTests.swift | 6 +- .../Attributes/DefaultTests.swift | 12 ++-- .../CommonStrategiesValueCoderTests.swift | 24 +++---- .../CodableInheritanceTests.swift | 18 ++--- Tests/MetaCodableTests/CodableTests.swift | 28 ++++---- .../CodedAs/CodedAsEnumTests.swift | 16 ++--- .../CodedAs/CodedAsTests.swift | 68 +++++++++---------- .../CodedAt/CodedAtDefaultChoiceTests.swift | 24 +++---- .../CodedAtDefaultOnlyMissingTests.swift | 24 +++---- .../CodedAt/CodedAtDefaultTests.swift | 24 +++---- .../CodedAt/CodedAtEnumTests.swift | 12 ++-- .../CodedAt/CodedAtHelperDefaultTests.swift | 18 ++--- .../CodedAt/CodedAtHelperTests.swift | 24 +++---- .../CodedAt/CodedAtTests.swift | 48 ++++++------- .../CodedAt/DecodedAtTests.swift | 32 ++++----- .../CodedAt/EncodedAtTests.swift | 32 ++++----- .../CodedBy/CodedByActionTests.swift | 18 ++--- .../CodedIn/CodedInDefaultTests.swift | 22 +++--- .../CodedInHelperDefaultChoiceTests.swift | 18 ++--- ...CodedInHelperDefaultOnlyMissingTests.swift | 18 ++--- .../CodedIn/CodedInHelperDefaultTests.swift | 18 ++--- .../CodedIn/CodedInHelperTests.swift | 18 ++--- .../CodedIn/CodedInTests.swift | 34 +++++----- .../CodingKeysGenerationTests.swift | 16 ++--- Tests/MetaCodableTests/CodingKeysTests.swift | 26 +++---- .../ConditionalCoderTests.swift | 10 +-- .../ConformCodableTests.swift | 24 +++---- Tests/MetaCodableTests/ContentAtTests.swift | 14 ++-- .../DecodedAtEncodedAtIntegrationTests.swift | 18 ++--- .../DefaultSequenceElementCodingTests.swift | 18 ++--- .../DynamicCodable/DynamicCodableTests.swift | 8 +-- .../DynamicCodableIdentifierTests.swift | 16 ++--- .../ExplicitCodingTests.swift | 22 +++--- Tests/MetaCodableTests/GenericsTests.swift | 38 +++++------ .../GroupedMutableVariableTests.swift | 10 +-- .../GroupedVariableTests.swift | 16 ++--- Tests/MetaCodableTests/HelperCoderTests.swift | 14 ++-- .../HelperCoders/DataCoderTests.swift | 4 +- .../HelperCoders/DateCoderTests.swift | 4 +- .../HelperCoders/HelperCodersTests.swift | 4 +- .../HelperCoders/LossySequenceTests.swift | 24 +++---- .../NonConformingCoderTests.swift | 12 ++-- .../HelperCoders/SequenceCoderTests.swift | 32 ++++----- .../HelperCoders/ValueCoderTests.swift | 24 +++---- .../MetaCodableTests/IgnoreCodingTests.swift | 54 +++++++-------- .../IgnoreInitializedTests.swift | 16 ++--- .../RawRepresentableEnumTests.swift | 16 ++--- .../MetaCodableTests/UntaggedEnumTests.swift | 22 +++--- .../VariableDeclarationTests.swift | 26 +++---- Tests/TODO/CoverageTracking.md | 13 ++++ 51 files changed, 542 insertions(+), 529 deletions(-) diff --git a/Tests/MetaCodableTests/AccessModifierTests.swift b/Tests/MetaCodableTests/AccessModifierTests.swift index dd41ac8323..ccc95eb81d 100644 --- a/Tests/MetaCodableTests/AccessModifierTests.swift +++ b/Tests/MetaCodableTests/AccessModifierTests.swift @@ -13,7 +13,7 @@ struct AccessModifierTests { let value: String } - @Test("expansion") + @Test("Generates @Codable conformance for class with 'open' access") func expansion() throws { assertMacroExpansion( """ @@ -51,7 +51,7 @@ struct AccessModifierTests { ) } - @Test("open Class Decoding Only") + @Test("Decodes class from JSON successfully") func openClassDecodingOnly() throws { // Open class doesn't have memberwise init, only decoder init let jsonStr = """ @@ -65,7 +65,7 @@ struct AccessModifierTests { #expect(decoded.value == "open_test") } - @Test("open Class From J S O N") + @Test("Decodes from JSON successfully") func openClassFromJSON() throws { let jsonStr = """ { @@ -87,7 +87,7 @@ struct AccessModifierTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with 'public' access") func expansion() throws { assertMacroExpansion( """ @@ -130,7 +130,7 @@ struct AccessModifierTests { ) } - @Test("public Struct Decoding And Encoding") + @Test("Encodes and decodes successfully") func publicStructDecodingAndEncoding() throws { let original = SomeCodable(value: "public_test") let encoded = try JSONEncoder().encode(original) @@ -139,7 +139,7 @@ struct AccessModifierTests { #expect(decoded.value == "public_test") } - @Test("public Struct From J S O N") + @Test("Decodes from JSON successfully (AccessModifierTests #1)") func publicStructFromJSON() throws { let jsonStr = """ { @@ -161,7 +161,7 @@ struct AccessModifierTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/Attributes/CodedByTests.swift b/Tests/MetaCodableTests/Attributes/CodedByTests.swift index 5802a80ccf..367094e89c 100644 --- a/Tests/MetaCodableTests/Attributes/CodedByTests.swift +++ b/Tests/MetaCodableTests/Attributes/CodedByTests.swift @@ -4,7 +4,7 @@ import Testing @Suite("Coded By Tests") struct CodedByTests { - @Test("misuse On Non Variable Declaration") + @Test("Reports error for @CodedBy misuse") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -35,7 +35,7 @@ struct CodedByTests { ) } - @Test("misuse On Static Variable") + @Test("Reports error for @CodedBy misuse (CodedByTests #1)") func misuseOnStaticVariable() throws { assertMacroExpansion( """ @@ -64,7 +64,7 @@ struct CodedByTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @CodedBy is applied multiple times") func duplicatedMisuse() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/Attributes/DefaultTests.swift b/Tests/MetaCodableTests/Attributes/DefaultTests.swift index 2fc45f8157..6487a825da 100644 --- a/Tests/MetaCodableTests/Attributes/DefaultTests.swift +++ b/Tests/MetaCodableTests/Attributes/DefaultTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Default Tests") struct DefaultTests { - @Test("misuse On Non Variable Declaration") + @Test("Reports error for @Default misuse") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -37,7 +37,7 @@ struct DefaultTests { ) } - @Test("misuse On Static Variable") + @Test("Reports error for @Default misuse (DefaultTests #1)") func misuseOnStaticVariable() throws { assertMacroExpansion( """ @@ -66,7 +66,7 @@ struct DefaultTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @Default is applied multiple times") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -115,7 +115,7 @@ struct DefaultTests { let number: Int } - @Test("default Value Usage") + @Test("Decodes from JSON successfully (DefaultTests #2)") func defaultValueUsage() throws { // Test with missing keys in JSON let jsonStr = "{}" @@ -126,7 +126,7 @@ struct DefaultTests { #expect(decoded.number == 42) } - @Test("override Default Values") + @Test("Decodes from JSON successfully (DefaultTests #3)") func overrideDefaultValues() throws { // Test with provided values in JSON let jsonStr = """ @@ -142,7 +142,7 @@ struct DefaultTests { #expect(decoded.number == 100) } - @Test("encoding With Defaults") + @Test("Encodes and decodes successfully (DefaultTests #1)") func encodingWithDefaults() throws { let original = SomeCodable(value: "test", number: 99) let encoded = try JSONEncoder().encode(original) diff --git a/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift b/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift index 3365a0796c..d5fe6ea918 100644 --- a/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift +++ b/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift @@ -26,7 +26,7 @@ struct CommonStrategiesValueCoderTests { let optGenString: String? } - @Test("test Parsing") + @Test("Encodes and decodes with JSON successfully") func testParsing() throws { let json = """ { @@ -57,7 +57,7 @@ struct CommonStrategiesValueCoderTests { #expect(reDecoded.string == "5265762156") } - @Test("expansion") + @Test("Generates @Codable conformance for struct with optional properties") func expansion() throws { assertMacroExpansion( """ @@ -183,7 +183,7 @@ struct CommonStrategiesValueCoderTests { let identifier: UUID } - @Test("test Non Conforming Types") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #1)") func testNonConformingTypes() throws { let json = """ { @@ -218,7 +218,7 @@ struct CommonStrategiesValueCoderTests { ) } - @Test("expansion") + @Test("Generates @Codable conformance for struct") func expansion() throws { assertMacroExpansion( """ @@ -280,7 +280,7 @@ struct CommonStrategiesValueCoderTests { let plainText: String } - @Test("test Custom Strategies") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #2)") func testCustomStrategies() throws { let json = """ { @@ -311,7 +311,7 @@ struct CommonStrategiesValueCoderTests { ) } - @Test("expansion") + @Test("Generates @Codable conformance for struct (CommonStrategiesValueCoderTests #1)") func expansion() throws { assertMacroExpansion( """ @@ -371,7 +371,7 @@ struct CommonStrategiesValueCoderTests { let string: String } - @Test("test Empty Strategies") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #3)") func testEmptyStrategies() throws { let json = """ { @@ -403,7 +403,7 @@ struct CommonStrategiesValueCoderTests { ) } - @Test("expansion") + @Test("Generates @Codable conformance for struct (CommonStrategiesValueCoderTests #2)") func expansion() throws { assertMacroExpansion( """ @@ -468,7 +468,7 @@ struct CommonStrategiesValueCoderTests { case pending(until: String) } - @Test("test Enum With Common Strategies") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #4)") func testEnumWithCommonStrategies() throws { // Test that associated values can use number-to-string conversion let json = """ @@ -531,7 +531,7 @@ struct CommonStrategiesValueCoderTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum") func expansion() throws { assertMacroExpansion( """ @@ -641,7 +641,7 @@ struct CommonStrategiesValueCoderTests { let count: Int } - @Test("test Helper Coder Override") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #5)") func testHelperCoderOverride() throws { let json = """ { @@ -668,7 +668,7 @@ struct CommonStrategiesValueCoderTests { #expect(encoded == #"{"count":42,"id":"21"}"#) // CustomIntCoder halves the value for id } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CommonStrategiesValueCoderTests #1)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodableInheritanceTests.swift b/Tests/MetaCodableTests/CodableInheritanceTests.swift index 9cf0d46890..4c5c05d5a7 100644 --- a/Tests/MetaCodableTests/CodableInheritanceTests.swift +++ b/Tests/MetaCodableTests/CodableInheritanceTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Codable Inheritance Tests") struct CodableInheritanceTests { - @Test("misuse On Non Class Declaration") + @Test("Reports error for @Codable misuse") func misuseOnNonClassDeclaration() throws { assertMacroExpansion( """ @@ -66,7 +66,7 @@ struct CodableInheritanceTests { init() {} } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class") func expansion() throws { assertMacroExpansion( """ @@ -110,7 +110,7 @@ struct CodableInheritanceTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (CodableInheritanceTests #2)") func decodingAndEncoding() throws { let original = SomeCodable() original.value = "inheritance_test" @@ -120,7 +120,7 @@ struct CodableInheritanceTests { #expect(decoded.value == "inheritance_test") } - @Test("decoding From J S O N") + @Test("Decodes from JSON successfully (CodableInheritanceTests #4)") func decodingFromJSON() throws { let jsonStr = """ { @@ -133,7 +133,7 @@ struct CodableInheritanceTests { #expect(decoded.value == "class_value") } - @Test("encoding To J S O N") + @Test("Encodes to JSON successfully") func encodingToJSON() throws { let original = SomeCodable() original.value = "encoded_class" @@ -157,7 +157,7 @@ struct CodableInheritanceTests { override init() { super.init() } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class (CodableInheritanceTests #1)") func expansion() throws { assertMacroExpansion( """ @@ -197,7 +197,7 @@ struct CodableInheritanceTests { ) } - @Test("inheritance Decoding And Encoding") + @Test("Encodes and decodes successfully (CodableInheritanceTests #3)") func inheritanceDecodingAndEncoding() throws { let original = SomeCodable() original.value = "inherited_test" @@ -207,7 +207,7 @@ struct CodableInheritanceTests { #expect(decoded.value == "inherited_test") } - @Test("inheritance From J S O N") + @Test("Decodes from JSON successfully (CodableInheritanceTests #5)") func inheritanceFromJSON() throws { let jsonStr = """ { @@ -233,7 +233,7 @@ struct CodableInheritanceTests { override init() { super.init() } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class (CodableInheritanceTests #2)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodableTests.swift b/Tests/MetaCodableTests/CodableTests.swift index 4c3f5f2c03..fe84e41091 100644 --- a/Tests/MetaCodableTests/CodableTests.swift +++ b/Tests/MetaCodableTests/CodableTests.swift @@ -30,7 +30,7 @@ struct CodableTests { } } - @Test("expansion generates correct Codable implementation") + @Test("Reports error for @Codable misuse (CodableTests #1)") func expansion() throws { assertMacroExpansion( """ @@ -80,7 +80,7 @@ struct CodableTests { ) } - @Test("encoding works with available attribute") + @Test("Encodes and decodes successfully (CodableTests #4)") @available(*, deprecated, message: "Deprecated") func availableAttributeEncoding() throws { let original = SomeCodable(value: "deprecated_test") @@ -90,7 +90,7 @@ struct CodableTests { #expect(decoded.value == "deprecated_test") } - @Test("decoding from JSON works with available attribute") + @Test("Decodes from JSON successfully (CodableTests #6)") @available(*, deprecated, message: "Deprecated") func availableAttributeFromJSON() throws { let jsonStr = """ @@ -118,7 +118,7 @@ struct CodableTests { } } - @Test("expansion generates correct Codable implementation") + @Test("Generates @Codable conformance for struct with 'public' access") func expansion() throws { assertMacroExpansion( """ @@ -166,7 +166,7 @@ struct CodableTests { ) } - @Test("basic Codable encoding works") + @Test("Encodes and decodes successfully (CodableTests #5)") func basicCodableEncoding() throws { let original = SomeCodable(value: "basic_test") let encoded = try JSONEncoder().encode(original) @@ -175,7 +175,7 @@ struct CodableTests { #expect(decoded.value == "basic_test") } - @Test("basic Codable decoding from JSON works") + @Test("Decodes from JSON successfully (CodableTests #7)") func basicCodableFromJSON() throws { let jsonStr = """ { @@ -188,7 +188,7 @@ struct CodableTests { #expect(decoded.value == "basic_value") } - @Test("static properties are ignored in encoding") + @Test("Encodes to JSON successfully (CodableTests #1)") func staticPropertiesIgnored() throws { let original = SomeCodable(value: "test") let encoded = try JSONEncoder().encode(original) @@ -211,7 +211,7 @@ struct CodableTests { let value3: String? } - @Test("expansion generates correct Codable implementation") + @Test("Generates @Codable conformance for struct with optional properties (CodableTests #1)") func expansion() throws { assertMacroExpansion( """ @@ -270,7 +270,7 @@ struct CodableTests { } } - @Test("expansion generates correct Codable implementation") + @Test("Generates @Codable conformance for struct (CodableTests #3)") func expansion() throws { assertMacroExpansion( """ @@ -320,7 +320,7 @@ struct CodableTests { } } - @Test("expansion generates correct Codable implementation") + @Test("Generates @Codable conformance for struct (CodableTests #4)") func expansion() throws { assertMacroExpansion( """ @@ -375,7 +375,7 @@ struct CodableTests { } } - @Test("expansion generates correct Codable implementation") + @Test("Generates @Codable conformance for struct (CodableTests #5)") func expansion() throws { assertMacroExpansion( """ @@ -428,7 +428,7 @@ struct CodableTests { } } - @Test("expansion generates correct Codable implementation") + @Test("Generates @Codable conformance for class") func expansion() throws { assertMacroExpansion( """ @@ -492,7 +492,7 @@ struct CodableTests { } } - @Test("expansion generates correct Codable implementation") + @Test("Generates @Codable conformance for class (CodableTests #1)") func expansion() throws { assertMacroExpansion( """ @@ -540,7 +540,7 @@ struct CodableTests { } } - @Test("expansion generates correct Codable implementation") + @Test("Generates @Codable conformance for class (CodableTests #2)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift index 25e0066758..76a04f450d 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift @@ -7,7 +7,7 @@ import Testing @Suite("Coded As Enum Tests") struct CodedAsEnumTests { - @Test("misuse On Non Case Declaration") + @Test("Reports error for @CodedAs misuse") func misuseOnNonCaseDeclaration() throws { assertMacroExpansion( """ @@ -47,7 +47,7 @@ struct CodedAsEnumTests { ) } - @Test("invalid Range Expression Type Diagnostic") + @Test("Reports error for @Codable misuse (CodedAsEnumTests #2)") func invalidRangeExpressionTypeDiagnostic() throws { assertMacroExpansion( """ @@ -165,7 +165,7 @@ struct CodedAsEnumTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @CodedAs is applied multiple times") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -210,7 +210,7 @@ struct CodedAsEnumTests { ) } - @Test("misuse In Combination With Ignore Coding Macro") + @Test("Reports error for @CodedAs misuse (CodedAsEnumTests #1)") func misuseInCombinationWithIgnoreCodingMacro() throws { assertMacroExpansion( """ @@ -255,7 +255,7 @@ struct CodedAsEnumTests { ) } - @Test("misuse On Non Enum Declaration") + @Test("Reports error for @Codable misuse (CodedAsEnumTests #3)") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -315,7 +315,7 @@ struct CodedAsEnumTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (CodedAsEnumTests #1)") func expansion() throws { assertMacroExpansion( """ @@ -413,7 +413,7 @@ struct CodedAsEnumTests { case multi(_ variable: Bool, val: Int, String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (CodedAsEnumTests #2)") func expansion() throws { assertMacroExpansion( """ @@ -548,7 +548,7 @@ struct CodedAsEnumTests { case multi(_ variable: Bool, val: Int, String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (CodedAsEnumTests #3)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift index ccff29be4d..8c749da677 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift @@ -7,7 +7,7 @@ import Testing @Suite("Coded As Tests") struct CodedAsTests { - @Test("misuse On Grouped Variable Declaration") + @Test("Reports error for @CodedAs misuse (CodedAsTests #2)") func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -28,7 +28,7 @@ struct CodedAsTests { ) } - @Test("misuse On Static Variable Declaration") + @Test("Reports error for @CodedAs misuse (CodedAsTests #3)") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct CodedAsTests { ) } - @Test("misuse In Combination With Ignore Coding Macro") + @Test("Reports error for @CodedAs misuse (CodedAsTests #4)") func misuseInCombinationWithIgnoreCodingMacro() throws { assertMacroExpansion( """ @@ -96,7 +96,7 @@ struct CodedAsTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @CodedAs is applied multiple times (CodedAsTests #1)") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -145,7 +145,7 @@ struct CodedAsTests { let value1: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #2)") func expansion() throws { assertMacroExpansion( """ @@ -213,7 +213,7 @@ struct CodedAsTests { ) } - @Test("coded As Key Mapping") + @Test("Encodes and decodes successfully (CodedAsTests #6)") func codedAsKeyMapping() throws { let original = SomeCodable(value: "test1", value1: "test2") let encoded = try JSONEncoder().encode(original) @@ -223,7 +223,7 @@ struct CodedAsTests { #expect(decoded.value1 == "test2") } - @Test("coded As From J S O N") + @Test("Decodes from JSON successfully (CodedAsTests #8)") func codedAsFromJSON() throws { let jsonStr = """ { @@ -238,7 +238,7 @@ struct CodedAsTests { #expect(decoded.value1 == "multi_mapped_value") } - @Test("coded As Alternative Keys") + @Test("Decodes from JSON successfully (CodedAsTests #9)") func codedAsAlternativeKeys() throws { // Test with key2 instead of key1 let jsonStr = """ @@ -254,7 +254,7 @@ struct CodedAsTests { #expect(decoded.value1 == "alternative_key_value") } - @Test("coded As J S O N Structure") + @Test("Encodes to JSON successfully (CodedAsTests #2)") func codedAsJSONStructure() throws { let original = SomeCodable(value: "test", value1: "test2") let encoded = try JSONEncoder().encode(original) @@ -283,7 +283,7 @@ struct CodedAsTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (CodedAsTests #4)") func expansion() throws { assertMacroExpansion( """ @@ -447,7 +447,7 @@ struct CodedAsTests { ) } - @Test("enum Mixed Literal Roundtrip") + @Test("Encodes and decodes successfully (CodedAsTests #7)") func enumMixedLiteralRoundtrip() throws { let loadCmd: Command = .load(key: "test_key") let encoded = try JSONEncoder().encode(loadCmd) @@ -460,7 +460,7 @@ struct CodedAsTests { } } - @Test("enum String Type Decoding") + @Test("Decodes from JSON successfully (CodedAsTests #10)") func enumStringTypeDecoding() throws { let jsonStr = """ { @@ -478,7 +478,7 @@ struct CodedAsTests { } } - @Test("enum Integer Type Decoding") + @Test("Decodes from JSON successfully (CodedAsTests #11)") func enumIntegerTypeDecoding() throws { let jsonStr = """ { @@ -496,7 +496,7 @@ struct CodedAsTests { } } - @Test("enum Boolean Type Decoding") + @Test("Decodes from JSON successfully (CodedAsTests #12)") func enumBooleanTypeDecoding() throws { let jsonStr = """ { @@ -514,7 +514,7 @@ struct CodedAsTests { } } - @Test("enum Double Type Decoding") + @Test("Decodes from JSON successfully (CodedAsTests #13)") func enumDoubleTypeDecoding() throws { let jsonStr = """ { @@ -532,7 +532,7 @@ struct CodedAsTests { } } - @Test("enum Store With Integer Type") + @Test("Decodes from JSON successfully (CodedAsTests #14)") func enumStoreWithIntegerType() throws { let jsonStr = """ { @@ -552,7 +552,7 @@ struct CodedAsTests { } } - @Test("enum Store With Boolean Type") + @Test("Decodes from JSON successfully (CodedAsTests #15)") func enumStoreWithBooleanType() throws { let jsonStr = """ { @@ -572,7 +572,7 @@ struct CodedAsTests { } } - @Test("enum Store With Double Type") + @Test("Decodes from JSON successfully (CodedAsTests #16)") func enumStoreWithDoubleType() throws { let jsonStr = """ { @@ -592,7 +592,7 @@ struct CodedAsTests { } } - @Test("enum Encoding Structure") + @Test("Encodes to JSON successfully (CodedAsTests #3)") func enumEncodingStructure() throws { let storeCmd: Command = .store(key: "test", value: 100) let encoded = try JSONEncoder().encode(storeCmd) @@ -606,7 +606,7 @@ struct CodedAsTests { #expect(json["value"] as? Int == 100) } - @Test("enum Load Encoding Structure") + @Test("Encodes to JSON successfully (CodedAsTests #4)") func enumLoadEncodingStructure() throws { let loadCmd: Command = .load(key: "load_test") let encoded = try JSONEncoder().encode(loadCmd) @@ -620,7 +620,7 @@ struct CodedAsTests { #expect(json["value"] == nil) // No value for load case } - @Test("enum Invalid Type Decoding") + @Test("Decodes from JSON successfully (CodedAsTests #17)") func enumInvalidTypeDecoding() throws { let jsonStr = """ { @@ -635,7 +635,7 @@ struct CodedAsTests { } } - @Test("enum Missing Type Decoding") + @Test("Decodes from JSON successfully (CodedAsTests #18)") func enumMissingTypeDecoding() throws { let jsonStr = """ { @@ -649,7 +649,7 @@ struct CodedAsTests { } } - @Test("enum Integer Range Load Case") + @Test("Decodes from JSON successfully (CodedAsTests #19)") func enumIntegerRangeLoadCase() throws { // Test integer in range 15..<20 for load case let jsonStr = """ @@ -669,7 +669,7 @@ struct CodedAsTests { } } - @Test("enum Integer Range Store Case") + @Test("Decodes from JSON successfully (CodedAsTests #20)") func enumIntegerRangeStoreCase() throws { // Test integer in range 35...40 for store case let jsonStr = """ @@ -691,7 +691,7 @@ struct CodedAsTests { } } - @Test("enum Integer Range Boundary Values") + @Test("Decodes from JSON successfully (CodedAsTests #21)") func enumIntegerRangeBoundaryValues() throws { // Test boundary values for ranges @@ -772,7 +772,7 @@ struct CodedAsTests { } } - @Test("enum Double Partial Range Load Case") + @Test("Decodes from JSON successfully (CodedAsTests #22)") func enumDoublePartialRangeLoadCase() throws { // Test double in partial range (-0.8)... for load case let jsonStr = """ @@ -792,7 +792,7 @@ struct CodedAsTests { } } - @Test("enum Double Partial Range Store Case") + @Test("Decodes from JSON successfully (CodedAsTests #23)") func enumDoublePartialRangeStoreCase() throws { // Test double in partial range ..<(-1.5) for store case let jsonStr = """ @@ -814,7 +814,7 @@ struct CodedAsTests { } } - @Test("enum Double Range Boundary Values") + @Test("Decodes from JSON successfully (CodedAsTests #24)") func enumDoubleRangeBoundaryValues() throws { // Test boundary values for double ranges @@ -853,7 +853,7 @@ struct CodedAsTests { } } - @Test("enum Range Values Priority Over Literals") + @Test("Decodes from JSON successfully (CodedAsTests #25)") func enumRangeValuesPriorityOverLiterals() throws { // Test that range values work alongside literal values // Integer 16 should match the range 15..<20 for load case, not the literal 12 @@ -891,7 +891,7 @@ struct CodedAsTests { let value1: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #3)") func expansion() throws { assertMacroExpansion( """ @@ -974,7 +974,7 @@ struct CodedAsTests { let value1: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #4)") func expansion() throws { assertMacroExpansion( """ @@ -1076,7 +1076,7 @@ struct CodedAsTests { let value1: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #5)") func expansion() throws { assertMacroExpansion( """ @@ -1170,7 +1170,7 @@ struct CodedAsTests { var fooBar: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #6)") func expansion() throws { assertMacroExpansion( """ @@ -1229,7 +1229,7 @@ struct CodedAsTests { var fooBar: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #7)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift index 94f37741ab..f69df9dd46 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift @@ -15,7 +15,7 @@ struct CodedAtDefaultChoiceTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #8)") func expansion() throws { assertMacroExpansion( """ @@ -67,7 +67,7 @@ struct CodedAtDefaultChoiceTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #9)") func expansion() throws { assertMacroExpansion( """ @@ -118,7 +118,7 @@ struct CodedAtDefaultChoiceTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #10)") func expansion() throws { assertMacroExpansion( """ @@ -171,7 +171,7 @@ struct CodedAtDefaultChoiceTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #11)") func expansion() throws { assertMacroExpansion( """ @@ -235,7 +235,7 @@ struct CodedAtDefaultChoiceTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #12)") func expansion() throws { assertMacroExpansion( """ @@ -298,7 +298,7 @@ struct CodedAtDefaultChoiceTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #13)") func expansion() throws { assertMacroExpansion( """ @@ -363,7 +363,7 @@ struct CodedAtDefaultChoiceTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths") func expansion() throws { assertMacroExpansion( """ @@ -461,7 +461,7 @@ struct CodedAtDefaultChoiceTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #1)") func expansion() throws { assertMacroExpansion( """ @@ -558,7 +558,7 @@ struct CodedAtDefaultChoiceTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #2)") func expansion() throws { assertMacroExpansion( """ @@ -664,7 +664,7 @@ struct CodedAtDefaultChoiceTests { let value4: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #3)") func expansion() throws { assertMacroExpansion( """ @@ -791,7 +791,7 @@ struct CodedAtDefaultChoiceTests { let value6: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #4)") func expansion() throws { assertMacroExpansion( """ @@ -942,7 +942,7 @@ struct CodedAtDefaultChoiceTests { let value6: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift index 3ff4685350..2b0f97ceba 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift @@ -15,7 +15,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #14)") func expansion() throws { assertMacroExpansion( """ @@ -63,7 +63,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #15)") func expansion() throws { assertMacroExpansion( """ @@ -110,7 +110,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #16)") func expansion() throws { assertMacroExpansion( """ @@ -159,7 +159,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #17)") func expansion() throws { assertMacroExpansion( """ @@ -215,7 +215,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #18)") func expansion() throws { assertMacroExpansion( """ @@ -270,7 +270,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #19)") func expansion() throws { assertMacroExpansion( """ @@ -327,7 +327,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #5)") func expansion() throws { assertMacroExpansion( """ @@ -397,7 +397,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #6)") func expansion() throws { assertMacroExpansion( """ @@ -466,7 +466,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #7)") func expansion() throws { assertMacroExpansion( """ @@ -544,7 +544,7 @@ struct CodedAtDefaultOnlyMissingTests { let value4: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #8)") func expansion() throws { assertMacroExpansion( """ @@ -652,7 +652,7 @@ struct CodedAtDefaultOnlyMissingTests { let value6: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #9)") func expansion() throws { assertMacroExpansion( """ @@ -779,7 +779,7 @@ struct CodedAtDefaultOnlyMissingTests { let value6: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtDefaultOnlyMissingTests #1)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift index b6275d8780..9df7d8076c 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift @@ -15,7 +15,7 @@ struct CodedAtDefaultTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #20)") func expansion() throws { assertMacroExpansion( """ @@ -67,7 +67,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #21)") func expansion() throws { assertMacroExpansion( """ @@ -118,7 +118,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #22)") func expansion() throws { assertMacroExpansion( """ @@ -171,7 +171,7 @@ struct CodedAtDefaultTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #23)") func expansion() throws { assertMacroExpansion( """ @@ -235,7 +235,7 @@ struct CodedAtDefaultTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #24)") func expansion() throws { assertMacroExpansion( """ @@ -298,7 +298,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #25)") func expansion() throws { assertMacroExpansion( """ @@ -363,7 +363,7 @@ struct CodedAtDefaultTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #10)") func expansion() throws { assertMacroExpansion( """ @@ -461,7 +461,7 @@ struct CodedAtDefaultTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #11)") func expansion() throws { assertMacroExpansion( """ @@ -558,7 +558,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #12)") func expansion() throws { assertMacroExpansion( """ @@ -664,7 +664,7 @@ struct CodedAtDefaultTests { let value4: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #13)") func expansion() throws { assertMacroExpansion( """ @@ -791,7 +791,7 @@ struct CodedAtDefaultTests { let value6: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #14)") func expansion() throws { assertMacroExpansion( """ @@ -941,7 +941,7 @@ struct CodedAtDefaultTests { let value6: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtDefaultTests #2)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift index 85d51f3088..355a8b6711 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Coded At Enum Tests") struct CodedAtEnumTests { - @Test("misuse On Non Enum Declaration") + @Test("Reports error when @CodedAt is used without @Codable") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -41,7 +41,7 @@ struct CodedAtEnumTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @Codable is applied multiple times") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -185,7 +185,7 @@ struct CodedAtEnumTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (CodedAtEnumTests #5)") func expansion() throws { assertMacroExpansion( """ @@ -288,7 +288,7 @@ struct CodedAtEnumTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (CodedAtEnumTests #6)") func expansion() throws { assertMacroExpansion( """ @@ -385,7 +385,7 @@ struct CodedAtEnumTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (CodedAtEnumTests #7)") func expansion() throws { assertMacroExpansion( """ @@ -500,7 +500,7 @@ struct CodedAtEnumTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtEnumTests #15)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift index 6982fdcb35..b6ac65e651 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift @@ -19,7 +19,7 @@ struct CodedAtHelperDefaultTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #26)") func expansion() throws { assertMacroExpansion( """ @@ -75,7 +75,7 @@ struct CodedAtHelperDefaultTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #27)") func expansion() throws { assertMacroExpansion( """ @@ -131,7 +131,7 @@ struct CodedAtHelperDefaultTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #28)") func expansion() throws { assertMacroExpansion( """ @@ -199,7 +199,7 @@ struct CodedAtHelperDefaultTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #29)") func expansion() throws { assertMacroExpansion( """ @@ -267,7 +267,7 @@ struct CodedAtHelperDefaultTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #16)") func expansion() throws { assertMacroExpansion( """ @@ -369,7 +369,7 @@ struct CodedAtHelperDefaultTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #17)") func expansion() throws { assertMacroExpansion( """ @@ -487,7 +487,7 @@ struct CodedAtHelperDefaultTests { let value5: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #18)") func expansion() throws { assertMacroExpansion( """ @@ -643,7 +643,7 @@ struct CodedAtHelperDefaultTests { let value6: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #19)") func expansion() throws { assertMacroExpansion( """ @@ -801,7 +801,7 @@ struct CodedAtHelperDefaultTests { let value6: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtHelperDefaultTests #3)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift index c52c22b576..930d1be0f8 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift @@ -19,7 +19,7 @@ struct CodedAtHelperTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #30)") func expansion() throws { assertMacroExpansion( """ @@ -56,7 +56,7 @@ struct CodedAtHelperTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (CodedAtHelperTests #8)") func decodingAndEncoding() throws { let original = SomeCodable(value: ["test1", "test2"]) let encoded = try JSONEncoder().encode(original) @@ -65,7 +65,7 @@ struct CodedAtHelperTests { #expect(decoded.value == ["test1", "test2"]) } - @Test("decoding From J S O N Array") + @Test("Decodes from JSON successfully (CodedAtHelperTests #26)") func decodingFromJSONArray() throws { let jsonStr = """ ["value1", "value2", "value3"] @@ -76,7 +76,7 @@ struct CodedAtHelperTests { #expect(decoded.value == ["value1", "value2", "value3"]) } - @Test("lossy Decoding With Invalid Values") + @Test("Decodes from JSON successfully (CodedAtHelperTests #27)") func lossyDecodingWithInvalidValues() throws { let jsonStr = """ ["valid", 123, "another_valid", null, true] @@ -101,7 +101,7 @@ struct CodedAtHelperTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #31)") func expansion() throws { assertMacroExpansion( """ @@ -151,7 +151,7 @@ struct CodedAtHelperTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #32)") func expansion() throws { assertMacroExpansion( """ @@ -209,7 +209,7 @@ struct CodedAtHelperTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #33)") func expansion() throws { assertMacroExpansion( """ @@ -267,7 +267,7 @@ struct CodedAtHelperTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #20)") func expansion() throws { assertMacroExpansion( """ @@ -331,7 +331,7 @@ struct CodedAtHelperTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #21)") func expansion() throws { assertMacroExpansion( """ @@ -413,7 +413,7 @@ struct CodedAtHelperTests { let value3: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #22)") func expansion() throws { assertMacroExpansion( """ @@ -509,7 +509,7 @@ struct CodedAtHelperTests { let value2: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #23)") func expansion() throws { assertMacroExpansion( """ @@ -585,7 +585,7 @@ struct CodedAtHelperTests { let value2: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtHelperTests #4)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift index 4c05a05240..f1b5a62ace 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Coded At Tests") struct CodedAtTests { - @Test("misuse On Non Variable Declaration") + @Test("Reports error for @CodedAt misuse") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -37,7 +37,7 @@ struct CodedAtTests { ) } - @Test("misuse On Grouped Variable Declaration") + @Test("Reports error for @CodedAt misuse (CodedAtTests #1)") func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -58,7 +58,7 @@ struct CodedAtTests { ) } - @Test("misuse On Static Variable Declaration") + @Test("Reports error for @CodedAt misuse (CodedAtTests #2)") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -87,7 +87,7 @@ struct CodedAtTests { ) } - @Test("misuse In Combination With Coded In Macro") + @Test("Reports error for @CodedAt misuse (CodedAtTests #3)") func misuseInCombinationWithCodedInMacro() throws { assertMacroExpansion( """ @@ -126,7 +126,7 @@ struct CodedAtTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @CodedAt is applied multiple times") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -174,7 +174,7 @@ struct CodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #34)") func expansion() throws { assertMacroExpansion( """ @@ -220,7 +220,7 @@ struct CodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #35)") func expansion() throws { assertMacroExpansion( """ @@ -265,7 +265,7 @@ struct CodedAtTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #36)") func expansion() throws { assertMacroExpansion( """ @@ -312,7 +312,7 @@ struct CodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #37)") func expansion() throws { assertMacroExpansion( """ @@ -356,7 +356,7 @@ struct CodedAtTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (CodedAtTests #9)") func decodingAndEncoding() throws { let original = SomeCodable(value: "test") let encoded = try JSONEncoder().encode(original) @@ -365,7 +365,7 @@ struct CodedAtTests { #expect(decoded.value == "test") } - @Test("decoding From J S O N") + @Test("Decodes from JSON successfully (CodedAtTests #28)") func decodingFromJSON() throws { let jsonStr = """ { @@ -378,7 +378,7 @@ struct CodedAtTests { #expect(decoded.value == "custom_value") } - @Test("encoding To J S O N") + @Test("Encodes to JSON successfully (CodedAtTests #5)") func encodingToJSON() throws { let original = SomeCodable(value: "encoded_value") let encoded = try JSONEncoder().encode(original) @@ -398,7 +398,7 @@ struct CodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #38)") func expansion() throws { assertMacroExpansion( """ @@ -442,7 +442,7 @@ struct CodedAtTests { ) } - @Test("decoding And Encoding With Value") + @Test("Encodes and decodes successfully (CodedAtTests #10)") func decodingAndEncodingWithValue() throws { let original = SomeCodable(value: "optional_test") let encoded = try JSONEncoder().encode(original) @@ -451,7 +451,7 @@ struct CodedAtTests { #expect(decoded.value == "optional_test") } - @Test("decoding And Encoding With Nil") + @Test("Encodes and decodes successfully (CodedAtTests #11)") func decodingAndEncodingWithNil() throws { let original = SomeCodable(value: nil) let encoded = try JSONEncoder().encode(original) @@ -460,7 +460,7 @@ struct CodedAtTests { #expect(decoded.value == nil) } - @Test("decoding From J S O N With Missing Key") + @Test("Decodes from JSON successfully (CodedAtTests #29)") func decodingFromJSONWithMissingKey() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -478,7 +478,7 @@ struct CodedAtTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #39)") func expansion() throws { assertMacroExpansion( """ @@ -533,7 +533,7 @@ struct CodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #24)") func expansion() throws { assertMacroExpansion( """ @@ -593,7 +593,7 @@ struct CodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #25)") func expansion() throws { assertMacroExpansion( """ @@ -660,7 +660,7 @@ struct CodedAtTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #26)") func expansion() throws { assertMacroExpansion( """ @@ -735,7 +735,7 @@ struct CodedAtTests { let value4: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #27)") func expansion() throws { assertMacroExpansion( """ @@ -832,7 +832,7 @@ struct CodedAtTests { let value3: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #28)") func expansion() throws { assertMacroExpansion( """ @@ -909,7 +909,7 @@ struct CodedAtTests { let value3: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtTests #5)") func expansion() throws { assertMacroExpansion( """ @@ -982,7 +982,7 @@ struct CodedAtTests { } #endif - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum with nested paths") func expansion() throws { #if swift(>=6) let decodablePrefix = "@preconcurrency " diff --git a/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift b/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift index ed5f3be2c5..49b8b07fe9 100644 --- a/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift +++ b/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Decoded At Tests") struct DecodedAtTests { - @Test("misuse On Non Variable Declaration") + @Test("Reports error for @DecodedAt misuse") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -36,7 +36,7 @@ struct DecodedAtTests { ) } - @Test("misuse On Grouped Variable Declaration") + @Test("Reports error for @DecodedAt misuse (DecodedAtTests #1)") func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct DecodedAtTests { ) } - @Test("misuse On Static Variable Declaration") + @Test("Reports error for @DecodedAt misuse (DecodedAtTests #2)") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -86,7 +86,7 @@ struct DecodedAtTests { ) } - @Test("misuse In Combination With Coded In Macro") + @Test("Reports error for @CodedIn misuse") func misuseInCombinationWithCodedInMacro() throws { assertMacroExpansion( """ @@ -125,7 +125,7 @@ struct DecodedAtTests { ) } - @Test("misuse In Combination With Coded At Macro") + @Test("Reports error for @CodedAt misuse (DecodedAtTests #4)") func misuseInCombinationWithCodedAtMacro() throws { assertMacroExpansion( """ @@ -164,7 +164,7 @@ struct DecodedAtTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @DecodedAt is applied multiple times") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -212,7 +212,7 @@ struct DecodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #40)") func expansion() throws { assertMacroExpansion( """ @@ -265,7 +265,7 @@ struct DecodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #41)") func expansion() throws { assertMacroExpansion( """ @@ -317,7 +317,7 @@ struct DecodedAtTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #42)") func expansion() throws { assertMacroExpansion( """ @@ -371,7 +371,7 @@ struct DecodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #43)") func expansion() throws { assertMacroExpansion( """ @@ -426,7 +426,7 @@ struct DecodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #44)") func expansion() throws { assertMacroExpansion( """ @@ -480,7 +480,7 @@ struct DecodedAtTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #45)") func expansion() throws { assertMacroExpansion( """ @@ -536,7 +536,7 @@ struct DecodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #29)") func expansion() throws { assertMacroExpansion( """ @@ -595,7 +595,7 @@ struct DecodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #30)") func expansion() throws { assertMacroExpansion( """ @@ -663,7 +663,7 @@ struct DecodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #31)") func expansion() throws { assertMacroExpansion( """ @@ -723,7 +723,7 @@ struct DecodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #32)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift b/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift index 048a645c72..ebd8b1f3fd 100644 --- a/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift +++ b/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Encoded At Tests") struct EncodedAtTests { - @Test("misuse On Non Variable Declaration") + @Test("Reports error for @EncodedAt misuse") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -36,7 +36,7 @@ struct EncodedAtTests { ) } - @Test("misuse On Grouped Variable Declaration") + @Test("Reports error for @EncodedAt misuse (EncodedAtTests #1)") func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct EncodedAtTests { ) } - @Test("misuse On Static Variable Declaration") + @Test("Reports error for @EncodedAt misuse (EncodedAtTests #2)") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -86,7 +86,7 @@ struct EncodedAtTests { ) } - @Test("misuse In Combination With Coded In Macro") + @Test("Reports error for @CodedIn misuse (EncodedAtTests #1)") func misuseInCombinationWithCodedInMacro() throws { assertMacroExpansion( """ @@ -125,7 +125,7 @@ struct EncodedAtTests { ) } - @Test("misuse In Combination With Coded At Macro") + @Test("Reports error for @CodedAt misuse (EncodedAtTests #5)") func misuseInCombinationWithCodedAtMacro() throws { assertMacroExpansion( """ @@ -164,7 +164,7 @@ struct EncodedAtTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @EncodedAt is applied multiple times") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -212,7 +212,7 @@ struct EncodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #46)") func expansion() throws { assertMacroExpansion( """ @@ -265,7 +265,7 @@ struct EncodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #47)") func expansion() throws { assertMacroExpansion( """ @@ -317,7 +317,7 @@ struct EncodedAtTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #48)") func expansion() throws { assertMacroExpansion( """ @@ -371,7 +371,7 @@ struct EncodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #49)") func expansion() throws { assertMacroExpansion( """ @@ -426,7 +426,7 @@ struct EncodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #50)") func expansion() throws { assertMacroExpansion( """ @@ -480,7 +480,7 @@ struct EncodedAtTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #51)") func expansion() throws { assertMacroExpansion( """ @@ -536,7 +536,7 @@ struct EncodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #33)") func expansion() throws { assertMacroExpansion( """ @@ -595,7 +595,7 @@ struct EncodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #34)") func expansion() throws { assertMacroExpansion( """ @@ -655,7 +655,7 @@ struct EncodedAtTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #35)") func expansion() throws { assertMacroExpansion( """ @@ -715,7 +715,7 @@ struct EncodedAtTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #36)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift b/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift index 009d42f5af..39ac2aebcb 100644 --- a/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift +++ b/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift @@ -44,7 +44,7 @@ struct CodedByActionTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #52)") func expansion() { assertMacroExpansion( """ @@ -170,7 +170,7 @@ struct CodedByActionTests { ) } - @Test("custom Coder Version Behavior") + @Test("Encodes and decodes successfully (CodedByActionTests #12)") func customCoderVersionBehavior() throws { // Test version 1 behavior let dog1 = Dog(name: "Buddy", version: 1, info: Dog.Info(tag: 5)) @@ -189,7 +189,7 @@ struct CodedByActionTests { #expect(decoded2.info.tag == 5) // Should be 5 after encode(-1) then decode(+1) } - @Test("custom Coder From J S O N") + @Test("Decodes from JSON successfully (CodedByActionTests #30)") func customCoderFromJSON() throws { let jsonStr = """ { @@ -245,7 +245,7 @@ struct CodedByActionTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #53)") func expansion() { assertMacroExpansion( """ @@ -427,7 +427,7 @@ struct CodedByActionTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedByActionTests #37)") func expansion() { assertMacroExpansion( """ @@ -609,7 +609,7 @@ struct CodedByActionTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedByActionTests #38)") func expansion() { assertMacroExpansion( """ @@ -808,7 +808,7 @@ struct CodedByActionTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedByActionTests #39)") func expansion() { assertMacroExpansion( """ @@ -1032,7 +1032,7 @@ struct CodedByActionTests { } #endif - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #54)") func expansion() { assertMacroExpansion( """ @@ -1204,7 +1204,7 @@ struct CodedByActionTests { } #endif - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #55)") func expansion() { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift index 28635a248f..ee650a7d04 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift @@ -14,7 +14,7 @@ struct CodedInDefaultTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInDefaultTests #56)") func expansion() throws { assertMacroExpansion( """ @@ -77,7 +77,7 @@ struct CodedInDefaultTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInDefaultTests #57)") func expansion() throws { assertMacroExpansion( """ @@ -191,7 +191,7 @@ struct CodedInDefaultTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #40)") func expansion() throws { assertMacroExpansion( """ @@ -272,7 +272,7 @@ struct CodedInDefaultTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #41)") func expansion() throws { assertMacroExpansion( """ @@ -352,7 +352,7 @@ struct CodedInDefaultTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #42)") func expansion() throws { assertMacroExpansion( """ @@ -434,7 +434,7 @@ struct CodedInDefaultTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #43)") func expansion() throws { assertMacroExpansion( """ @@ -532,7 +532,7 @@ struct CodedInDefaultTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #44)") func expansion() throws { assertMacroExpansion( """ @@ -629,7 +629,7 @@ struct CodedInDefaultTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #45)") func expansion() throws { assertMacroExpansion( """ @@ -733,7 +733,7 @@ struct CodedInDefaultTests { let value3: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #46)") func expansion() throws { assertMacroExpansion( """ @@ -852,7 +852,7 @@ struct CodedInDefaultTests { let value6: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #47)") func expansion() throws { assertMacroExpansion( """ @@ -1018,7 +1018,7 @@ struct CodedInDefaultTests { let value6: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInDefaultTests #6)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift index 5bc572733c..7b73582827 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift @@ -18,7 +18,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultChoiceTests #58)") func expansion() throws { assertMacroExpansion( """ @@ -85,7 +85,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultChoiceTests #59)") func expansion() throws { assertMacroExpansion( """ @@ -153,7 +153,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #48)") func expansion() throws { assertMacroExpansion( """ @@ -238,7 +238,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #49)") func expansion() throws { assertMacroExpansion( """ @@ -323,7 +323,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #50)") func expansion() throws { assertMacroExpansion( """ @@ -425,7 +425,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #51)") func expansion() throws { assertMacroExpansion( """ @@ -543,7 +543,7 @@ struct CodedInHelperDefaultChoiceTests { let value5: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #52)") func expansion() throws { assertMacroExpansion( """ @@ -699,7 +699,7 @@ struct CodedInHelperDefaultChoiceTests { let value6: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #53)") func expansion() throws { assertMacroExpansion( """ @@ -857,7 +857,7 @@ struct CodedInHelperDefaultChoiceTests { let value6: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperDefaultChoiceTests #7)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift index 3fbf7e8f15..066ab14b2d 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift @@ -18,7 +18,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultOnlyMissingTests #60)") func expansion() throws { assertMacroExpansion( """ @@ -77,7 +77,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultOnlyMissingTests #61)") func expansion() throws { assertMacroExpansion( """ @@ -137,7 +137,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #54)") func expansion() throws { assertMacroExpansion( """ @@ -204,7 +204,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #55)") func expansion() throws { assertMacroExpansion( """ @@ -271,7 +271,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #56)") func expansion() throws { assertMacroExpansion( """ @@ -345,7 +345,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #57)") func expansion() throws { assertMacroExpansion( """ @@ -435,7 +435,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value5: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #58)") func expansion() throws { assertMacroExpansion( """ @@ -567,7 +567,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value6: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #59)") func expansion() throws { assertMacroExpansion( """ @@ -706,7 +706,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value6: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperDefaultOnlyMissingTests #8)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift index 0a48143656..71ef312b18 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift @@ -18,7 +18,7 @@ struct CodedInHelperDefaultTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultTests #62)") func expansion() throws { assertMacroExpansion( """ @@ -85,7 +85,7 @@ struct CodedInHelperDefaultTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultTests #63)") func expansion() throws { assertMacroExpansion( """ @@ -153,7 +153,7 @@ struct CodedInHelperDefaultTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #60)") func expansion() throws { assertMacroExpansion( """ @@ -238,7 +238,7 @@ struct CodedInHelperDefaultTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #61)") func expansion() throws { assertMacroExpansion( """ @@ -323,7 +323,7 @@ struct CodedInHelperDefaultTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #62)") func expansion() throws { assertMacroExpansion( """ @@ -425,7 +425,7 @@ struct CodedInHelperDefaultTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #63)") func expansion() throws { assertMacroExpansion( """ @@ -543,7 +543,7 @@ struct CodedInHelperDefaultTests { let value5: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #64)") func expansion() throws { assertMacroExpansion( """ @@ -699,7 +699,7 @@ struct CodedInHelperDefaultTests { let value6: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #65)") func expansion() throws { assertMacroExpansion( """ @@ -857,7 +857,7 @@ struct CodedInHelperDefaultTests { let value6: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperDefaultTests #9)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift index dd0073eaa4..44db335db8 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift @@ -17,7 +17,7 @@ struct CodedInHelperTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperTests #64)") func expansion() throws { assertMacroExpansion( """ @@ -74,7 +74,7 @@ struct CodedInHelperTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperTests #65)") func expansion() throws { assertMacroExpansion( """ @@ -132,7 +132,7 @@ struct CodedInHelperTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #66)") func expansion() throws { assertMacroExpansion( """ @@ -193,7 +193,7 @@ struct CodedInHelperTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #67)") func expansion() throws { assertMacroExpansion( """ @@ -258,7 +258,7 @@ struct CodedInHelperTests { let value: [String] } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #68)") func expansion() throws { assertMacroExpansion( """ @@ -322,7 +322,7 @@ struct CodedInHelperTests { let value: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #69)") func expansion() throws { assertMacroExpansion( """ @@ -404,7 +404,7 @@ struct CodedInHelperTests { let value3: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #70)") func expansion() throws { assertMacroExpansion( """ @@ -500,7 +500,7 @@ struct CodedInHelperTests { let value2: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #71)") func expansion() throws { assertMacroExpansion( """ @@ -576,7 +576,7 @@ struct CodedInHelperTests { let value2: [String]? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperTests #10)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInTests.swift index 1302fe7caf..d414d091f4 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Coded In Tests") struct CodedInTests { - @Test("misuse On Non Variable Declaration") + @Test("Reports error for @CodedIn misuse (CodedInTests #2)") func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -37,7 +37,7 @@ struct CodedInTests { ) } - @Test("misuse On Static Variable Declaration") + @Test("Reports error for @CodedIn misuse (CodedInTests #3)") func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -66,7 +66,7 @@ struct CodedInTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @CodedIn is applied multiple times") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -114,7 +114,7 @@ struct CodedInTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInTests #66)") func expansion() throws { assertMacroExpansion( """ @@ -168,7 +168,7 @@ struct CodedInTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodedInTests #67)") func expansion() throws { assertMacroExpansion( """ @@ -263,7 +263,7 @@ struct CodedInTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #72)") func expansion() throws { assertMacroExpansion( """ @@ -320,7 +320,7 @@ struct CodedInTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #73)") func expansion() throws { assertMacroExpansion( """ @@ -429,7 +429,7 @@ struct CodedInTests { let value: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #74)") func expansion() throws { assertMacroExpansion( """ @@ -479,7 +479,7 @@ struct CodedInTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (CodedInTests #13)") func decodingAndEncoding() throws { let original = SomeCodable(value: "nested_test") let encoded = try JSONEncoder().encode(original) @@ -488,7 +488,7 @@ struct CodedInTests { #expect(decoded.value == "nested_test") } - @Test("decoding From Nested J S O N") + @Test("Decodes from JSON successfully (CodedInTests #31)") func decodingFromNestedJSON() throws { let jsonStr = """ { @@ -505,7 +505,7 @@ struct CodedInTests { #expect(decoded.value == "deep_value") } - @Test("encoding To Nested J S O N") + @Test("Encodes to JSON successfully (CodedInTests #6)") func encodingToNestedJSON() throws { let original = SomeCodable(value: "encoded_nested") let encoded = try JSONEncoder().encode(original) @@ -527,7 +527,7 @@ struct CodedInTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #75)") func expansion() throws { assertMacroExpansion( """ @@ -594,7 +594,7 @@ struct CodedInTests { let value: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #76)") func expansion() throws { assertMacroExpansion( """ @@ -667,7 +667,7 @@ struct CodedInTests { let value3: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #77)") func expansion() throws { assertMacroExpansion( """ @@ -768,7 +768,7 @@ struct CodedInTests { let value3: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #78)") func expansion() throws { assertMacroExpansion( """ @@ -859,7 +859,7 @@ struct CodedInTests { let value3: String! } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInTests #11)") func expansion() throws { assertMacroExpansion( """ @@ -946,7 +946,7 @@ struct CodedInTests { } #endif - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum with nested paths (CodedInTests #1)") func expansion() throws { #if swift(>=6) let decodablePrefix = "@preconcurrency " diff --git a/Tests/MetaCodableTests/CodingKeysGenerationTests.swift b/Tests/MetaCodableTests/CodingKeysGenerationTests.swift index 14a5786390..63c0cbfc51 100644 --- a/Tests/MetaCodableTests/CodingKeysGenerationTests.swift +++ b/Tests/MetaCodableTests/CodingKeysGenerationTests.swift @@ -13,7 +13,7 @@ struct CodingKeysGenerationTests { let `internal`: String } - @Test("expansion") + @Test("Generates @Codable conformance for struct (CodingKeysGenerationTests #6)") func expansion() throws { assertMacroExpansion( """ @@ -51,7 +51,7 @@ struct CodingKeysGenerationTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (CodingKeysGenerationTests #14)") func decodingAndEncoding() throws { let original = SomeCodable(internal: "reserved") let encoded = try JSONEncoder().encode(original) @@ -60,7 +60,7 @@ struct CodingKeysGenerationTests { #expect(decoded.internal == "reserved") } - @Test("decoding From J S O N") + @Test("Decodes from JSON successfully (CodingKeysGenerationTests #32)") func decodingFromJSON() throws { let jsonStr = """ { @@ -84,7 +84,7 @@ struct CodingKeysGenerationTests { let val2: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodingKeysGenerationTests #79)") func expansion() throws { assertMacroExpansion( """ @@ -135,7 +135,7 @@ struct CodingKeysGenerationTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (CodingKeysGenerationTests #15)") func decodingAndEncoding() throws { let original = SomeCodable(val1: "first", val2: "second") let encoded = try JSONEncoder().encode(original) @@ -145,7 +145,7 @@ struct CodingKeysGenerationTests { #expect(decoded.val2 == "second") } - @Test("decoding From J S O N") + @Test("Decodes from JSON successfully (CodingKeysGenerationTests #33)") func decodingFromJSON() throws { let jsonStr = """ { @@ -173,7 +173,7 @@ struct CodingKeysGenerationTests { let val: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodingKeysGenerationTests #80)") func expansion() throws { assertMacroExpansion( """ @@ -228,7 +228,7 @@ struct CodingKeysGenerationTests { let val3: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodingKeysGenerationTests #81)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodingKeysTests.swift b/Tests/MetaCodableTests/CodingKeysTests.swift index e425fed378..05f6884e7b 100644 --- a/Tests/MetaCodableTests/CodingKeysTests.swift +++ b/Tests/MetaCodableTests/CodingKeysTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Coding Keys Tests") struct CodingKeysTests { - @Test("misuse In Absence Of Codable") + @Test("Reports error when @CodingKeys is used without @Codable") func misuseInAbsenceOfCodable() throws { assertMacroExpansion( """ @@ -40,7 +40,7 @@ struct CodingKeysTests { ) } - @Test("misuse On Duplication Absence Of Codable") + @Test("Reports error when @Codable is applied multiple times (CodingKeysTests #1)") func misuseOnDuplicationAbsenceOfCodable() throws { assertMacroExpansion( """ @@ -124,7 +124,7 @@ struct CodingKeysTests { let description: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #68)") func expansion() throws { assertMacroExpansion( """ @@ -184,7 +184,7 @@ struct CodingKeysTests { let description: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #69)") func expansion() throws { assertMacroExpansion( """ @@ -244,7 +244,7 @@ struct CodingKeysTests { let description: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class (CodingKeysTests #3)") func expansion() throws { assertMacroExpansion( """ @@ -308,7 +308,7 @@ struct CodingKeysTests { case multi(_ variable: Bool, val: Int, String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (CodingKeysTests #8)") func expansion() throws { assertMacroExpansion( """ @@ -430,7 +430,7 @@ struct CodingKeysTests { let description: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #70)") func expansion() throws { assertMacroExpansion( """ @@ -490,7 +490,7 @@ struct CodingKeysTests { let description: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #71)") func expansion() throws { assertMacroExpansion( """ @@ -550,7 +550,7 @@ struct CodingKeysTests { let description: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #72)") func expansion() throws { assertMacroExpansion( """ @@ -610,7 +610,7 @@ struct CodingKeysTests { let description: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #73)") func expansion() throws { assertMacroExpansion( """ @@ -670,7 +670,7 @@ struct CodingKeysTests { let description: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #74)") func expansion() throws { assertMacroExpansion( """ @@ -730,7 +730,7 @@ struct CodingKeysTests { let description: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #75)") func expansion() throws { assertMacroExpansion( """ @@ -795,7 +795,7 @@ struct CodingKeysTests { case multi(_ variable: Bool, val: Int, String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (CodingKeysTests #9)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/ConditionalCoderTests.swift b/Tests/MetaCodableTests/ConditionalCoderTests.swift index afb277dd8c..b16407f321 100644 --- a/Tests/MetaCodableTests/ConditionalCoderTests.swift +++ b/Tests/MetaCodableTests/ConditionalCoderTests.swift @@ -79,7 +79,7 @@ struct ConditionalCoderTests { // MARK: - decodeIfPresent Tests /// Tests that `decodeIfPresent` uses the decoder coder and returns value. - @Test("decodeIfPresent returns value when data is valid") + @Test("Decodes from JSON successfully (ConditionalCoderTests #34)") func decodeIfPresentReturnsValue() throws { let json = #"{"value": "test"}"# let data = json.data(using: .utf8)! @@ -89,7 +89,7 @@ struct ConditionalCoderTests { } /// Tests that `decodeIfPresent` returns nil when value is null. - @Test("decodeIfPresent returns nil when value is null") + @Test("Decodes from JSON successfully (ConditionalCoderTests #35)") func decodeIfPresentReturnsNilForNull() throws { let json = #"{"value": null}"# let data = json.data(using: .utf8)! @@ -99,7 +99,7 @@ struct ConditionalCoderTests { } /// Tests that `decodeIfPresent` returns nil when key is missing. - @Test("decodeIfPresent returns nil when key is missing") + @Test("Decodes from JSON successfully (ConditionalCoderTests #36)") func decodeIfPresentReturnsNilForMissingKey() throws { let json = #"{}"# let data = json.data(using: .utf8)! @@ -111,7 +111,7 @@ struct ConditionalCoderTests { // MARK: - encodeIfPresent Tests /// Tests that `encodeIfPresent` uses the encoder coder when value is present. - @Test("encodeIfPresent encodes when value is present") + @Test("Encodes to JSON successfully (ConditionalCoderTests #7)") func encodeIfPresentEncodesValue() throws { let wrapper = EncodingWrapper(value: "test") let data = try JSONEncoder().encode(wrapper) @@ -121,7 +121,7 @@ struct ConditionalCoderTests { } /// Tests that `encodeIfPresent` skips encoding when value is nil. - @Test("encodeIfPresent skips encoding when value is nil") + @Test("Encodes to JSON successfully (ConditionalCoderTests #8)") func encodeIfPresentSkipsNil() throws { let wrapper = EncodingWrapper(value: nil) let data = try JSONEncoder().encode(wrapper) diff --git a/Tests/MetaCodableTests/ConformCodableTests.swift b/Tests/MetaCodableTests/ConformCodableTests.swift index f941cf9e79..9d1dabd25a 100644 --- a/Tests/MetaCodableTests/ConformCodableTests.swift +++ b/Tests/MetaCodableTests/ConformCodableTests.swift @@ -11,7 +11,7 @@ import Testing @Suite("Conform Encodable Tests") struct ConformEncodableTests { - @Test("misuse With Codable") + @Test("Reports error for @Codable misuse (ConformCodableTests #4)") func misuseWithCodable() throws { assertMacroExpansion( """ @@ -52,7 +52,7 @@ struct ConformEncodableTests { ) } - @Test("misuse With Decodable") + @Test("Reports diagnostic error") func misuseWithDecodable() throws { assertMacroExpansion( """ @@ -101,7 +101,7 @@ struct ConformEncodableTests { let count: Int } - @Test("expansion") + @Test("Generates macro expansion for struct") func expansion() throws { assertMacroExpansion( """ @@ -147,7 +147,7 @@ struct ConformEncodableTests { let string: String } - @Test("test Parsing") + @Test("Encodes to JSON successfully (ConformCodableTests #9)") func testParsing() throws { let model = Model( bool: true, int: 42, double: 3.1416, string: "5265762156") @@ -169,7 +169,7 @@ struct ConformEncodableTests { #expect(reDecoded["string"] as? String == "5265762156") } - @Test("expansion") + @Test("Generates macro expansion for struct (ConformCodableTests #1)") func expansion() throws { assertMacroExpansion( """ @@ -224,7 +224,7 @@ struct ConformEncodableTests { let count: Int } - @Test("expansion") + @Test("Generates macro expansion with @CodedAt for struct with nested paths") func expansion() throws { assertMacroExpansion( """ @@ -277,7 +277,7 @@ struct ConformDecodableTests { let count: Int } - @Test("expansion") + @Test("Generates macro expansion for struct (ConformCodableTests #2)") func expansion() throws { assertMacroExpansion( """ @@ -312,7 +312,7 @@ struct ConformDecodableTests { ) } - @Test("decoding Only") + @Test("Decodes from JSON successfully (ConformCodableTests #37)") func decodingOnly() throws { // Since SomeDecodable only conforms to Decodable, we can only test decoding let jsonStr = """ @@ -328,7 +328,7 @@ struct ConformDecodableTests { #expect(decoded.count == 42) } - @Test("decoding From J S O N") + @Test("Decodes from JSON successfully (ConformCodableTests #38)") func decodingFromJSON() throws { let jsonStr = """ { @@ -354,7 +354,7 @@ struct ConformDecodableTests { let string: String } - @Test("test Parsing") + @Test("Decodes from JSON successfully (ConformCodableTests #39)") func testParsing() throws { let json = """ { @@ -375,7 +375,7 @@ struct ConformDecodableTests { #expect(model.string == "5265762156") } - @Test("expansion") + @Test("Generates macro expansion for struct (ConformCodableTests #3)") func expansion() throws { assertMacroExpansion( """ @@ -430,7 +430,7 @@ struct ConformDecodableTests { let count: Int } - @Test("expansion") + @Test("Generates macro expansion with @CodedAt for struct with nested paths (ConformCodableTests #1)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/ContentAtTests.swift b/Tests/MetaCodableTests/ContentAtTests.swift index 92206154ec..085eed9570 100644 --- a/Tests/MetaCodableTests/ContentAtTests.swift +++ b/Tests/MetaCodableTests/ContentAtTests.swift @@ -7,7 +7,7 @@ import Testing @Suite("Content At Tests") struct ContentAtTests { - @Test("misuse On Non Enum Declaration") + @Test("Reports error when @ContentAt is used without @Codable") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct ContentAtTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (ContentAtTests #10)") func expansion() throws { assertMacroExpansion( """ @@ -147,7 +147,7 @@ struct ContentAtTests { ) } - @Test("content At Encoding Structure") + @Test("Encodes to JSON successfully (ContentAtTests #10)") func contentAtEncodingStructure() throws { let loadCommand: Command = .load(key: "test_key") let encoded = try JSONEncoder().encode(loadCommand) @@ -160,7 +160,7 @@ struct ContentAtTests { #expect(content["key"] as? String == "test_key") } - @Test("content At From J S O N") + @Test("Decodes from JSON successfully (ContentAtTests #40)") func contentAtFromJSON() throws { // The decoding expects key/value at root level, not in content let jsonStr = """ @@ -181,7 +181,7 @@ struct ContentAtTests { } } - @Test("content At J S O N Structure") + @Test("Encodes to JSON successfully (ContentAtTests #11)") func contentAtJSONStructure() throws { let storeCommand: Command = .store(key: "test", value: 100) let encoded = try JSONEncoder().encode(storeCommand) @@ -209,7 +209,7 @@ struct ContentAtTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (ContentAtTests #11)") func expansion() throws { assertMacroExpansion( """ @@ -311,7 +311,7 @@ struct ContentAtTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (ContentAtTests #12)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift b/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift index 4526cfc61d..9aeaa23493 100644 --- a/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift +++ b/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift @@ -18,7 +18,7 @@ struct DecodedAtEncodedAtIntegrationTests { let age: Int } - @Test("different Paths For Decoding And Encoding") + @Test("Encodes and decodes with JSON successfully (DecodedAtEncodedAtIntegrationTests #6)") func differentPathsForDecodingAndEncoding() throws { // Sample JSON with nested structure for decoding let jsonData = """ @@ -67,7 +67,7 @@ struct DecodedAtEncodedAtIntegrationTests { let createdAt: String } - @Test("complex Nested Structure") + @Test("Encodes and decodes with JSON successfully (DecodedAtEncodedAtIntegrationTests #7)") func complexNestedStructure() throws { // Complex nested JSON for decoding let jsonData = """ @@ -119,7 +119,7 @@ struct DecodedAtEncodedAtIntegrationTests { let value: Int? } - @Test("optional Values") + @Test("Encodes and decodes with JSON successfully (DecodedAtEncodedAtIntegrationTests #8)") func optionalValues() throws { // JSON with all values present let fullJsonData = """ @@ -177,7 +177,7 @@ struct DecodedAtEncodedAtIntegrationTests { @Suite("Decoded At Encoded At Integration - Enum") struct EnumTests { - @Test("misuse On Non Enum Declaration") + @Test("Reports error when @DecodedAt is used without @Codable") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -222,7 +222,7 @@ struct DecodedAtEncodedAtIntegrationTests { ) } - @Test("duplicated Misuse") + @Test("Reports error when @Codable is applied multiple times (DecodedAtEncodedAtIntegrationTests #2)") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -377,7 +377,7 @@ struct DecodedAtEncodedAtIntegrationTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (DecodedAtEncodedAtIntegrationTests #13)") func expansion() throws { assertMacroExpansion( """ @@ -483,7 +483,7 @@ struct DecodedAtEncodedAtIntegrationTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (DecodedAtEncodedAtIntegrationTests #14)") func expansion() throws { assertMacroExpansion( """ @@ -583,7 +583,7 @@ struct DecodedAtEncodedAtIntegrationTests { case store(key: String, value: Int) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (DecodedAtEncodedAtIntegrationTests #15)") func expansion() throws { assertMacroExpansion( """ @@ -701,7 +701,7 @@ struct DecodedAtEncodedAtIntegrationTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtEncodedAtIntegrationTests #82)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift index 3593d3447d..58d7381127 100644 --- a/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift +++ b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift @@ -44,7 +44,7 @@ struct DefaultSequenceElementCodingTests { // MARK: - decodeIfPresent(from:) Tests /// Tests that `decodeIfPresent(from:)` returns value from single value container. - @Test("decodeIfPresent from decoder returns value when present") + @Test("Decodes struct from JSON successfully") func decodeIfPresentFromDecoderReturnsValue() throws { let json = #""test""# let data = json.data(using: .utf8)! @@ -63,7 +63,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `decodeIfPresent(from:)` returns nil for null. - @Test("decodeIfPresent from decoder returns nil for null") + @Test("Decodes struct from JSON successfully (DefaultSequenceElementCodingTests #1)") func decodeIfPresentFromDecoderReturnsNilForNull() throws { let json = #"null"# let data = json.data(using: .utf8)! @@ -84,7 +84,7 @@ struct DefaultSequenceElementCodingTests { // MARK: - decodeIfPresent(from:forKey:) Tests /// Tests that `decodeIfPresent(from:forKey:)` returns value when present. - @Test("decodeIfPresent from keyed container returns value") + @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #41)") func decodeIfPresentFromKeyedContainerReturnsValue() throws { let json = #"{"value": "test"}"# let data = json.data(using: .utf8)! @@ -94,7 +94,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `decodeIfPresent(from:forKey:)` returns nil for null. - @Test("decodeIfPresent from keyed container returns nil for null") + @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #42)") func decodeIfPresentFromKeyedContainerReturnsNilForNull() throws { let json = #"{"value": null}"# let data = json.data(using: .utf8)! @@ -104,7 +104,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `decodeIfPresent(from:forKey:)` returns nil for missing key. - @Test("decodeIfPresent from keyed container returns nil for missing key") + @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #43)") func decodeIfPresentFromKeyedContainerReturnsNilForMissingKey() throws { let json = #"{}"# let data = json.data(using: .utf8)! @@ -116,7 +116,7 @@ struct DefaultSequenceElementCodingTests { // MARK: - encodeIfPresent(_:to:) Tests /// Tests that `encodeIfPresent(_:to:)` encodes value when present. - @Test("encodeIfPresent to encoder encodes value when present") + @Test("Encodes struct to JSON successfully") func encodeIfPresentToEncoderEncodesValue() throws { struct SingleValueWrapper: Encodable { let value: String? @@ -135,7 +135,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `encodeIfPresent(_:to:)` encodes null for nil. - @Test("encodeIfPresent to encoder encodes null for nil") + @Test("Encodes struct to JSON successfully (DefaultSequenceElementCodingTests #1)") func encodeIfPresentToEncoderEncodesNullForNil() throws { struct SingleValueWrapper: Encodable { let value: String? @@ -156,7 +156,7 @@ struct DefaultSequenceElementCodingTests { // MARK: - encodeIfPresent(_:to:atKey:) Tests /// Tests that `encodeIfPresent(_:to:atKey:)` encodes value when present. - @Test("encodeIfPresent to keyed container encodes value when present") + @Test("Encodes to JSON successfully (DefaultSequenceElementCodingTests #12)") func encodeIfPresentToKeyedContainerEncodesValue() throws { let wrapper = EncodingWrapper(value: "test") let data = try JSONEncoder().encode(wrapper) @@ -166,7 +166,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `encodeIfPresent(_:to:atKey:)` skips encoding for nil. - @Test("encodeIfPresent to keyed container skips encoding for nil") + @Test("Encodes to JSON successfully (DefaultSequenceElementCodingTests #13)") func encodeIfPresentToKeyedContainerSkipsNil() throws { let wrapper = EncodingWrapper(value: nil) let data = try JSONEncoder().encode(wrapper) diff --git a/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift b/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift index 713ce5710e..8ac768da8b 100644 --- a/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift +++ b/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift @@ -4,7 +4,7 @@ import Testing @Suite("Dynamic Codable Tests") struct DynamicCodableTests { - @Test("page With Ext Post") + @Test("Decodes from JSON successfully (DynamicCodableTests #44)") func pageWithExtPost() throws { let page = try JSONDecoder().decode( PageWithExtPosts.self, from: dataPageWithExtPosts @@ -27,7 +27,7 @@ struct DynamicCodableTests { } } - @Test("page With Int Post") + @Test("Decodes from JSON successfully (DynamicCodableTests #45)") func pageWithIntPost() throws { let page = try JSONDecoder().decode( PageWithIntPosts.self, from: dataPageWithIntPosts @@ -50,7 +50,7 @@ struct DynamicCodableTests { } } - @Test("page With Adj Post") + @Test("Decodes from JSON successfully (DynamicCodableTests #46)") func pageWithAdjPost() throws { let page = try JSONDecoder().decode( PageWithAdjPosts.self, from: dataPageWithAdjPosts @@ -73,7 +73,7 @@ struct DynamicCodableTests { } } - @Test("response") + @Test("Decodes from JSON successfully (DynamicCodableTests #47)") func response() throws { let rResponse = try JSONDecoder().decode( Response.self, from: registrationResponseAttributesData diff --git a/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift index aee9ab3238..1bcdbf5af9 100644 --- a/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift +++ b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift @@ -15,7 +15,7 @@ struct DynamicCodableIdentifierTests { /// /// DynamicCodableIdentifier uses string-based keys only, /// so integer initialization is not supported. - @Test("init(intValue:) returns nil") + @Test("Tests init int value returns nil") func initIntValueReturnsNil() { let identifier = DynamicCodableIdentifier(intValue: 0) #expect(identifier == nil) @@ -28,7 +28,7 @@ struct DynamicCodableIdentifierTests { } /// Tests that `intValue` property always returns nil. - @Test("intValue property returns nil") + @Test("Tests int value property returns nil") func intValuePropertyReturnsNil() { let identifier: DynamicCodableIdentifier = .one("test") #expect(identifier.intValue == nil) @@ -40,7 +40,7 @@ struct DynamicCodableIdentifierTests { // MARK: - init(stringValue:) Tests /// Tests that `init(stringValue:)` creates a single identifier. - @Test("init(stringValue:) creates single identifier") + @Test("Tests init string value creates single identifier") func initStringValueCreatesSingleIdentifier() { let identifier = DynamicCodableIdentifier(stringValue: "test") #expect(identifier != nil) @@ -50,21 +50,21 @@ struct DynamicCodableIdentifierTests { // MARK: - stringValue Tests /// Tests that `stringValue` returns the value for single identifier. - @Test("stringValue returns value for single identifier") + @Test("Tests string value returns single value") func stringValueReturnsSingleValue() { let identifier: DynamicCodableIdentifier = .one("myKey") #expect(identifier.stringValue == "myKey") } /// Tests that `stringValue` returns first value for multiple identifiers. - @Test("stringValue returns first value for multiple identifiers") + @Test("Tests string value returns first value") func stringValueReturnsFirstValue() { let identifier: DynamicCodableIdentifier = .many(["first", "second", "third"]) #expect(identifier.stringValue == "first") } /// Tests that `stringValue` returns empty string for empty multiple identifiers. - @Test("stringValue returns empty string for empty array") + @Test("Tests string value returns empty for empty array") func stringValueReturnsEmptyForEmptyArray() { let identifier: DynamicCodableIdentifier = .many([]) #expect(identifier.stringValue == "") @@ -73,7 +73,7 @@ struct DynamicCodableIdentifierTests { // MARK: - Pattern Matching Tests /// Tests pattern matching with single identifier. - @Test("pattern matching works with single identifier") + @Test("Tests pattern matching single identifier") func patternMatchingSingleIdentifier() { let identifier: DynamicCodableIdentifier = .one("type") @@ -92,7 +92,7 @@ struct DynamicCodableIdentifierTests { } /// Tests pattern matching with multiple identifiers. - @Test("pattern matching works with multiple identifiers") + @Test("Tests pattern matching multiple identifiers") func patternMatchingMultipleIdentifiers() { let identifier: DynamicCodableIdentifier = .many(["type", "kind", "category"]) diff --git a/Tests/MetaCodableTests/ExplicitCodingTests.swift b/Tests/MetaCodableTests/ExplicitCodingTests.swift index eaa65d51c4..ebd7f27d4c 100644 --- a/Tests/MetaCodableTests/ExplicitCodingTests.swift +++ b/Tests/MetaCodableTests/ExplicitCodingTests.swift @@ -14,7 +14,7 @@ struct ExplicitCodingTests { var value: String { "some" } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #76)") func expansion() throws { assertMacroExpansion( """ @@ -51,7 +51,7 @@ struct ExplicitCodingTests { ) } - @Test("encoding Only") + @Test("Encodes to JSON successfully (ExplicitCodingTests #14)") func encodingOnly() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -61,7 +61,7 @@ struct ExplicitCodingTests { #expect(json["value"] as? String == "some") } - @Test("decoding Empty") + @Test("Decodes from JSON successfully (ExplicitCodingTests #48)") func decodingEmpty() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -81,7 +81,7 @@ struct ExplicitCodingTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #77)") func expansion() throws { assertMacroExpansion( """ @@ -126,7 +126,7 @@ struct ExplicitCodingTests { ) } - @Test("encoding Only") + @Test("Encodes to JSON successfully (ExplicitCodingTests #15)") func encodingOnly() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -136,7 +136,7 @@ struct ExplicitCodingTests { #expect(json["value"] as? String == "some") } - @Test("decoding Empty") + @Test("Decodes from JSON successfully (ExplicitCodingTests #49)") func decodingEmpty() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -157,7 +157,7 @@ struct ExplicitCodingTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #78)") func expansion() throws { assertMacroExpansion( """ @@ -200,7 +200,7 @@ struct ExplicitCodingTests { ) } - @Test("encoding Only") + @Test("Encodes to JSON successfully (ExplicitCodingTests #16)") func encodingOnly() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -210,7 +210,7 @@ struct ExplicitCodingTests { #expect(json["value"] as? String == "someVal") } - @Test("decoding Empty") + @Test("Decodes from JSON successfully (ExplicitCodingTests #50)") func decodingEmpty() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -231,7 +231,7 @@ struct ExplicitCodingTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class (ExplicitCodingTests #4)") func expansion() throws { assertMacroExpansion( """ @@ -289,7 +289,7 @@ struct ExplicitCodingTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #79)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GenericsTests.swift b/Tests/MetaCodableTests/GenericsTests.swift index 32533e8f57..2aded696e2 100644 --- a/Tests/MetaCodableTests/GenericsTests.swift +++ b/Tests/MetaCodableTests/GenericsTests.swift @@ -13,7 +13,7 @@ struct GenericsTests { let value: T } - @Test("expansion") + @Test("Generates @Codable conformance for struct (GenericsTests #7)") func expansion() throws { assertMacroExpansion( """ @@ -51,7 +51,7 @@ struct GenericsTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (GenericsTests #16)") func decodingAndEncoding() throws { let original = GenericCodable(value: "test") let encoded = try JSONEncoder().encode(original) @@ -60,7 +60,7 @@ struct GenericsTests { #expect(decoded.value == "test") } - @Test("decoding And Encoding With Int") + @Test("Encodes and decodes successfully (GenericsTests #17)") func decodingAndEncodingWithInt() throws { let original = GenericCodable(value: 42) let encoded = try JSONEncoder().encode(original) @@ -69,7 +69,7 @@ struct GenericsTests { #expect(decoded.value == 42) } - @Test("decoding From J S O N") + @Test("Decodes from JSON successfully (GenericsTests #51)") func decodingFromJSON() throws { let jsonStr = """ { @@ -92,7 +92,7 @@ struct GenericsTests { let value3: V } - @Test("expansion") + @Test("Generates @Codable conformance for struct (GenericsTests #8)") func expansion() throws { assertMacroExpansion( """ @@ -140,7 +140,7 @@ struct GenericsTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (GenericsTests #18)") func decodingAndEncoding() throws { let original = GenericCodable( value1: "test", value2: 42, value3: true) @@ -152,7 +152,7 @@ struct GenericsTests { #expect(decoded.value3 == true) } - @Test("decoding From J S O N") + @Test("Decodes from JSON successfully (GenericsTests #52)") func decodingFromJSON() throws { let jsonStr = """ { @@ -179,7 +179,7 @@ struct GenericsTests { case three(V) } - @Test("expansion") + @Test("Generates @Codable conformance for enum") func expansion() throws { assertMacroExpansion( """ @@ -259,7 +259,7 @@ struct GenericsTests { ) } - @Test("decoding And Encoding Case One") + @Test("Encodes and decodes successfully (GenericsTests #19)") func decodingAndEncodingCaseOne() throws { let original: GenericCodable = .one("test") let encoded = try JSONEncoder().encode(original) @@ -272,7 +272,7 @@ struct GenericsTests { } } - @Test("decoding And Encoding Case Two") + @Test("Encodes and decodes successfully (GenericsTests #20)") func decodingAndEncodingCaseTwo() throws { let original: GenericCodable = .two(42) let encoded = try JSONEncoder().encode(original) @@ -285,7 +285,7 @@ struct GenericsTests { } } - @Test("decoding From J S O N") + @Test("Decodes from JSON successfully (GenericsTests #53)") func decodingFromJSON() throws { let jsonStr = """ { @@ -311,7 +311,7 @@ struct GenericsTests { let str: String } - @Test("expansion") + @Test("Generates @Codable conformance for struct (GenericsTests #9)") func expansion() throws { assertMacroExpansion( """ @@ -363,7 +363,7 @@ struct GenericsTests { let str: String } - @Test("expansion") + @Test("Generates @Codable conformance for class (GenericsTests #3)") func expansion() throws { assertMacroExpansion( """ @@ -416,7 +416,7 @@ struct GenericsTests { case two(String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (GenericsTests #16)") func expansion() throws { assertMacroExpansion( """ @@ -493,7 +493,7 @@ struct GenericsTests { let str: String } - @Test("expansion") + @Test("Generates @Codable conformance for struct (GenericsTests #10)") func expansion() throws { assertMacroExpansion( """ @@ -543,7 +543,7 @@ struct GenericsTests { let str: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GenericsTests #80)") func expansion() throws { assertMacroExpansion( """ @@ -597,7 +597,7 @@ struct GenericsTests { let str: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GenericsTests #81)") func expansion() throws { assertMacroExpansion( """ @@ -650,7 +650,7 @@ struct GenericsTests { let str: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class (GenericsTests #5)") func expansion() throws { assertMacroExpansion( """ @@ -703,7 +703,7 @@ struct GenericsTests { case two(String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (GenericsTests #17)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GroupedMutableVariableTests.swift b/Tests/MetaCodableTests/GroupedMutableVariableTests.swift index 882e51d88e..af08abb2b4 100644 --- a/Tests/MetaCodableTests/GroupedMutableVariableTests.swift +++ b/Tests/MetaCodableTests/GroupedMutableVariableTests.swift @@ -13,7 +13,7 @@ struct GroupedMutableVariableTests { var one, two, three: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #82)") func expansion() throws { assertMacroExpansion( """ @@ -73,7 +73,7 @@ struct GroupedMutableVariableTests { var one, two: String, three: String = "" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #83)") func expansion() throws { assertMacroExpansion( """ @@ -138,7 +138,7 @@ struct GroupedMutableVariableTests { var one, two: String, three: Int } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #84)") func expansion() throws { assertMacroExpansion( """ @@ -240,7 +240,7 @@ struct GroupedMutableVariableTests { var one: String, two: String = "", three: Int } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #85)") func expansion() throws { assertMacroExpansion( """ @@ -297,7 +297,7 @@ struct GroupedMutableVariableTests { } } - @Test("mixed Types With Some Initialized Without Explicit Typing") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #86)") func mixedTypesWithSomeInitializedWithoutExplicitTyping() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GroupedVariableTests.swift b/Tests/MetaCodableTests/GroupedVariableTests.swift index 44e08d9423..75fbf3d8dd 100644 --- a/Tests/MetaCodableTests/GroupedVariableTests.swift +++ b/Tests/MetaCodableTests/GroupedVariableTests.swift @@ -14,7 +14,7 @@ struct GroupedVariableTests { let one, two, three: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #87)") func expansion() throws { assertMacroExpansion( """ @@ -65,7 +65,7 @@ struct GroupedVariableTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (GroupedVariableTests #21)") func decodingAndEncoding() throws { let original = SomeCodable( one: "first", two: "second", three: "third") @@ -77,7 +77,7 @@ struct GroupedVariableTests { #expect(decoded.three == "third") } - @Test("decoding From J S O N") + @Test("Decodes from JSON successfully (GroupedVariableTests #54)") func decodingFromJSON() throws { let jsonStr = """ { @@ -94,7 +94,7 @@ struct GroupedVariableTests { #expect(decoded.three == "value3") } - @Test("encoding To J S O N") + @Test("Encodes to JSON successfully (GroupedVariableTests #17)") func encodingToJSON() throws { let original = SomeCodable(one: "a", two: "b", three: "c") let encoded = try JSONEncoder().encode(original) @@ -115,7 +115,7 @@ struct GroupedVariableTests { let one, two: String, three: String = "" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #88)") func expansion() throws { assertMacroExpansion( """ @@ -173,7 +173,7 @@ struct GroupedVariableTests { let one, two: String, three: Int } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #89)") func expansion() throws { assertMacroExpansion( """ @@ -271,7 +271,7 @@ struct GroupedVariableTests { let one: String, two: String = "", three: Int } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #90)") func expansion() throws { assertMacroExpansion( """ @@ -329,7 +329,7 @@ struct GroupedVariableTests { let one: String, two = "", three: Int } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #91)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/HelperCoderTests.swift b/Tests/MetaCodableTests/HelperCoderTests.swift index 86c7a483a1..5ef4edbb17 100644 --- a/Tests/MetaCodableTests/HelperCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoderTests.swift @@ -34,7 +34,7 @@ struct HelperCoderTests { // MARK: - decodeIfPresent Tests /// Tests that `decodeIfPresent` returns a value when valid data is present. - @Test("decodeIfPresent returns value when data is valid") + @Test("Decodes struct from JSON successfully (HelperCoderTests #2)") func decodeIfPresentWithValidData() throws { let json = #"{"value": "test"}"# let data = json.data(using: .utf8)! @@ -62,7 +62,7 @@ struct HelperCoderTests { } /// Tests that `decodeIfPresent` returns nil when data is null. - @Test("decodeIfPresent returns nil when data is null") + @Test("Decodes struct from JSON successfully (HelperCoderTests #3)") func decodeIfPresentWithNullData() throws { let json = #"{"value": null}"# let data = json.data(using: .utf8)! @@ -90,7 +90,7 @@ struct HelperCoderTests { } /// Tests that `decodeIfPresent` returns nil when key is missing. - @Test("decodeIfPresent returns nil when key is missing") + @Test("Decodes struct from JSON successfully (HelperCoderTests #4)") func decodeIfPresentWithMissingKey() throws { let json = #"{}"# let data = json.data(using: .utf8)! @@ -120,7 +120,7 @@ struct HelperCoderTests { // MARK: - encode Tests /// Tests that `encode` works for Encodable types. - @Test("encode works for Encodable types") + @Test("Encodes struct to JSON successfully (HelperCoderTests #2)") func encodeEncodableType() throws { struct Container: Encodable { let value: String @@ -145,7 +145,7 @@ struct HelperCoderTests { } /// Tests that `encode` does nothing for non-Encodable types (default implementation). - @Test("encode does nothing for non-Encodable types") + @Test("Encodes struct to JSON successfully (HelperCoderTests #3)") func encodeNonEncodableType() throws { struct Container: Encodable { let nonEncodable: NonEncodableValue @@ -174,7 +174,7 @@ struct HelperCoderTests { // MARK: - encodeIfPresent Tests /// Tests that `encodeIfPresent` encodes when value is present. - @Test("encodeIfPresent encodes when value is present") + @Test("Encodes struct to JSON successfully (HelperCoderTests #4)") func encodeIfPresentWithValue() throws { struct Container: Encodable { let value: String? @@ -199,7 +199,7 @@ struct HelperCoderTests { } /// Tests that `encodeIfPresent` skips encoding when value is nil. - @Test("encodeIfPresent skips encoding when value is nil") + @Test("Encodes struct to JSON successfully (HelperCoderTests #5)") func encodeIfPresentWithNil() throws { struct Container: Encodable { let value: String? diff --git a/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift index 9647ce0b1d..cd8bf5283e 100644 --- a/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Data Coder Tests") struct DataCoderTests { - @Test("decoding") + @Test("Encodes and decodes with JSON successfully (DataCoderTests #9)") func decoding() throws { let jsonStr = """ { @@ -20,7 +20,7 @@ struct DataCoderTests { #expect(newModel == model) } - @Test("invalid Data Decoding") + @Test("Decodes from JSON successfully (DataCoderTests #55)") func invalidDataDecoding() throws { let jsonStr = """ { diff --git a/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift index b16c6854d3..1c04a67fb6 100644 --- a/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Date Coder Tests") struct DateCoderTests { - @Test("decoding") + @Test("Encodes and decodes with JSON successfully (DateCoderTests #10)") func decoding() throws { let jsonStr = """ { @@ -31,7 +31,7 @@ struct DateCoderTests { #expect(newModel == model) } - @Test("invalid Decoding") + @Test("Decodes from JSON successfully (DateCoderTests #56)") func invalidDecoding() throws { let jsonStr = """ { diff --git a/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift b/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift index 8c240dd26b..3564c47b49 100644 --- a/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Helper Coders Tests") struct HelperCodersTests { - @Test("conditional And Optional Coding") + @Test("Encodes and decodes with JSON successfully (HelperCodersTests #11)") func conditionalAndOptionalCoding() throws { let jsonStr = """ { @@ -25,7 +25,7 @@ struct HelperCodersTests { #expect(model.optionalDate == nil) } - @Test("property Wrapper Coding") + @Test("Encodes and decodes with JSON successfully (HelperCodersTests #12)") func propertyWrapperCoding() throws { let jsonStr = """ { diff --git a/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift b/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift index 864bb25777..cdacc73c95 100644 --- a/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Lossy Sequence Tests") struct LossySequenceTests { @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("invalid Data Type") + @Test("Decodes from JSON successfully (LossySequenceTests #57)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func invalidDataType() throws { #expect(throws: DecodingError.self) { @@ -15,7 +15,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("empty Data") + @Test("Decodes from JSON successfully (LossySequenceTests #58)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func emptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! @@ -24,7 +24,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("valid Data") + @Test("Encodes and decodes successfully (LossySequenceTests #22)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func validData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! @@ -35,7 +35,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("invalid Data") + @Test("Decodes from JSON successfully (LossySequenceTests #59)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func invalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -44,7 +44,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("optional Invalid Data Type") + @Test("Decodes from JSON successfully (LossySequenceTests #60)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalInvalidDataType() throws { #expect(throws: DecodingError.self) { @@ -56,7 +56,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("optional Empty Data") + @Test("Decodes from JSON successfully (LossySequenceTests #61)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalEmptyData() throws { let json = "{}".data(using: .utf8)! @@ -65,7 +65,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("optional Valid Data") + @Test("Encodes and decodes successfully (LossySequenceTests #23)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! @@ -76,7 +76,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("optional Invalid Data") + @Test("Decodes from JSON successfully (LossySequenceTests #62)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -85,7 +85,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("default Invalid Data Type") + @Test("Decodes from JSON successfully (LossySequenceTests #63)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultInvalidDataType() throws { let json = #"{"data":1}"#.data(using: .utf8)! @@ -94,7 +94,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("default Empty Data") + @Test("Decodes from JSON successfully (LossySequenceTests #64)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! @@ -103,7 +103,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("default Valid Data") + @Test("Encodes and decodes successfully (LossySequenceTests #24)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! @@ -114,7 +114,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("default Invalid Data") + @Test("Decodes from JSON successfully (LossySequenceTests #65)") @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! diff --git a/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift index 940ea94023..80a5aeb0fc 100644 --- a/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Non Conforming Coder Tests") struct NonConformingCoderTests { - @Test("test Decoding Actual Float") + @Test("Encodes and decodes successfully (NonConformingCoderTests #25)") func testDecodingActualFloat() throws { let json = try mockJSON(5.5) let model = try JSONDecoder().decode(Model.self, from: json) @@ -15,7 +15,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == 5.5) } - @Test("test Decoding Stringified Float") + @Test("Encodes and decodes successfully (NonConformingCoderTests #26)") func testDecodingStringifiedFloat() throws { let json = try mockJSON("5.5") let model = try JSONDecoder().decode(Model.self, from: json) @@ -25,7 +25,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == 5.5) } - @Test("test Decoding Positive Infinity") + @Test("Encodes and decodes successfully (NonConformingCoderTests #27)") func testDecodingPositiveInfinity() throws { let json = try mockJSON("➕♾️") let model = try JSONDecoder().decode(Model.self, from: json) @@ -35,7 +35,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == .infinity) } - @Test("test Decoding Negative Infinity") + @Test("Encodes and decodes successfully (NonConformingCoderTests #28)") func testDecodingNegativeInfinity() throws { let json = try mockJSON("➖♾️") let model = try JSONDecoder().decode(Model.self, from: json) @@ -45,7 +45,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == -.infinity) } - @Test("test Decoding Not A Number") + @Test("Encodes and decodes successfully (NonConformingCoderTests #29)") func testDecodingNotANumber() throws { let json = try mockJSON("😞") let model = try JSONDecoder().decode(Model.self, from: json) @@ -55,7 +55,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float.isNaN) } - @Test("invalid Decoding") + @Test("Decodes from JSON successfully (NonConformingCoderTests #66)") func invalidDecoding() throws { let json = try mockJSON("random") #expect(throws: DecodingError.self) { diff --git a/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift index 9902394c9b..05df5c0ce6 100644 --- a/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift @@ -8,7 +8,7 @@ struct SequenceCoderTests { let decoder = JSONDecoder() let encoder = JSONEncoder() - @Test("invalid Data Type") + @Test("Decodes from JSON successfully (SequenceCoderTests #67)") func invalidDataType() throws { #expect(throws: DecodingError.self) { let json = #"{"data":1}"#.data(using: .utf8)! @@ -16,14 +16,14 @@ struct SequenceCoderTests { } } - @Test("empty Data") + @Test("Decodes from JSON successfully (SequenceCoderTests #68)") func emptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(Container.self, from: json) #expect(val.data.isEmpty) } - @Test("valid Data") + @Test("Encodes and decodes successfully (SequenceCoderTests #30)") func validData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(Container.self, from: json) @@ -32,7 +32,7 @@ struct SequenceCoderTests { #expect(data == json) } - @Test("invalid Data") + @Test("Decodes from JSON successfully (SequenceCoderTests #69)") func invalidData() throws { #expect(throws: DecodingError.self) { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -40,7 +40,7 @@ struct SequenceCoderTests { } } - @Test("lossy Invalid Data Type") + @Test("Decodes from JSON successfully (SequenceCoderTests #70)") func lossyInvalidDataType() throws { #expect(throws: DecodingError.self) { let json = #"{"data":1}"#.data(using: .utf8)! @@ -48,14 +48,14 @@ struct SequenceCoderTests { } } - @Test("lossy Empty Data") + @Test("Decodes from JSON successfully (SequenceCoderTests #71)") func lossyEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(LossyContainer.self, from: json) #expect(val.data.isEmpty) } - @Test("lossy Valid Data") + @Test("Encodes and decodes successfully (SequenceCoderTests #31)") func lossyValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyContainer.self, from: json) @@ -64,28 +64,28 @@ struct SequenceCoderTests { #expect(data == json) } - @Test("lossy Invalid Data") + @Test("Decodes from JSON successfully (SequenceCoderTests #72)") func lossyInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyContainer.self, from: json) #expect(val.data == ["1", "2"]) } - @Test("default Invalid Data Type") + @Test("Decodes from JSON successfully (SequenceCoderTests #73)") func defaultInvalidDataType() throws { let json = #"{"data":1}"#.data(using: .utf8)! let val = try decoder.decode(DefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test("default Empty Data") + @Test("Decodes from JSON successfully (SequenceCoderTests #74)") func defaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(DefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test("default Valid Data") + @Test("Encodes and decodes successfully (SequenceCoderTests #32)") func defaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(DefaultContainer.self, from: json) @@ -94,7 +94,7 @@ struct SequenceCoderTests { #expect(data == json) } - @Test("default Invalid Data") + @Test("Decodes from JSON successfully (SequenceCoderTests #75)") func defaultInvalidData() throws { #expect(throws: DecodingError.self) { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -102,21 +102,21 @@ struct SequenceCoderTests { } } - @Test("lossy Default Invalid Data Type") + @Test("Decodes from JSON successfully (SequenceCoderTests #76)") func lossyDefaultInvalidDataType() throws { let json = #"{"data":1}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test("lossy Default Empty Data") + @Test("Decodes from JSON successfully (SequenceCoderTests #77)") func lossyDefaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test("lossy Default Valid Data") + @Test("Encodes and decodes successfully (SequenceCoderTests #33)") func lossyDefaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) @@ -125,7 +125,7 @@ struct SequenceCoderTests { #expect(data == json) } - @Test("lossy Default Invalid Data") + @Test("Encodes and decodes successfully (SequenceCoderTests #34)") func lossyDefaultInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) diff --git a/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift index bf065daf89..72f227fefc 100644 --- a/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Value Coder Tests") struct ValueCoderTests { - @Test("actual Type Decoding") + @Test("Encodes and decodes successfully (ValueCoderTests #35)") func actualTypeDecoding() throws { let json = try mockJSON(true, 5, 5.5, "some") let model = try JSONDecoder().decode(Model.self, from: json) @@ -22,7 +22,7 @@ struct ValueCoderTests { } // MARK: Bool - @Test("int To Boolean Decoding") + @Test("Decodes from JSON successfully (ValueCoderTests #78)") func intToBooleanDecoding() throws { let json1 = try mockJSON(1, 5, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -32,7 +32,7 @@ struct ValueCoderTests { #expect(!model2.bool) } - @Test("int To Boolean Decoding Failure") + @Test("Decodes from JSON successfully (ValueCoderTests #79)") func intToBooleanDecodingFailure() throws { #expect(throws: DecodingError.self) { let json = try mockJSON(2, 5, 5.5, "some") @@ -40,7 +40,7 @@ struct ValueCoderTests { } } - @Test("float To Boolean Decoding") + @Test("Decodes from JSON successfully (ValueCoderTests #80)") func floatToBooleanDecoding() throws { let json1 = try mockJSON(1.0, 5, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -50,7 +50,7 @@ struct ValueCoderTests { #expect(!model2.bool) } - @Test("float To Boolean Decoding Failure") + @Test("Decodes from JSON successfully (ValueCoderTests #81)") func floatToBooleanDecodingFailure() throws { #expect(throws: DecodingError.self) { let json = try mockJSON(1.1, 5, 5.5, "some") @@ -81,7 +81,7 @@ struct ValueCoderTests { } // MARK: Int - @Test("bool To Int Decoding") + @Test("Decodes from JSON successfully (ValueCoderTests #82)") func boolToIntDecoding() throws { let json1 = try mockJSON(true, true, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -91,7 +91,7 @@ struct ValueCoderTests { #expect(model2.int == 0) } - @Test("float To Int Decoding") + @Test("Decodes from JSON successfully (ValueCoderTests #83)") func floatToIntDecoding() throws { let json1 = try mockJSON(true, 5.0, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -101,7 +101,7 @@ struct ValueCoderTests { #expect(model2.int == 0) } - @Test("float To Int Decoding Failure") + @Test("Decodes from JSON successfully (ValueCoderTests #84)") func floatToIntDecodingFailure() throws { #expect(throws: DecodingError.self) { let json = try mockJSON(true, 5.5, 5.5, "some") @@ -125,7 +125,7 @@ struct ValueCoderTests { } // MARK: Float - @Test("bool To Float Decoding") + @Test("Decodes from JSON successfully (ValueCoderTests #85)") func boolToFloatDecoding() throws { let json1 = try mockJSON(true, 5, true, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -135,7 +135,7 @@ struct ValueCoderTests { #expect(model2.double == 0) } - @Test("int To Float Decoding") + @Test("Decodes from JSON successfully (ValueCoderTests #86)") func intToFloatDecoding() throws { let json1 = try mockJSON(true, 5, 5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -161,7 +161,7 @@ struct ValueCoderTests { } // MARK: String - @Test("bool To String Decoding") + @Test("Decodes from JSON successfully (ValueCoderTests #87)") func boolToStringDecoding() throws { let json1 = try mockJSON(true, 5, 5.5, true) let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -171,7 +171,7 @@ struct ValueCoderTests { #expect(model2.string == "false") } - @Test("int To String Decoding") + @Test("Decodes from JSON successfully (ValueCoderTests #88)") func intToStringDecoding() throws { let json1 = try mockJSON(true, 5, 5.5, 5) let model1 = try JSONDecoder().decode(Model.self, from: json1) diff --git a/Tests/MetaCodableTests/IgnoreCodingTests.swift b/Tests/MetaCodableTests/IgnoreCodingTests.swift index 954941abea..5fbfb750c4 100644 --- a/Tests/MetaCodableTests/IgnoreCodingTests.swift +++ b/Tests/MetaCodableTests/IgnoreCodingTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Ignore Coding Tests") struct IgnoreCodingTests { - @Test("misuse On Uninitialized Variable") + @Test("Reports error for @Codable misuse (IgnoreCodingTests #5)") func misuseOnUninitializedVariable() throws { assertMacroExpansion( """ @@ -97,7 +97,7 @@ struct IgnoreCodingTests { ) } - @Test("misuse With Invalid Combination") + @Test("Reports error for @Codable misuse (IgnoreCodingTests #6)") func misuseWithInvalidCombination() throws { assertMacroExpansion( """ @@ -155,7 +155,7 @@ struct IgnoreCodingTests { var one: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #92)") func expansion() throws { assertMacroExpansion( """ @@ -184,7 +184,7 @@ struct IgnoreCodingTests { ) } - @Test("ignore Coding Behavior") + @Test("Encodes to JSON successfully (IgnoreCodingTests #18)") func ignoreCodingBehavior() throws { let original = SomeCodable() #expect(original.one == "some") // Default value @@ -196,7 +196,7 @@ struct IgnoreCodingTests { } } - @Test("ignore Coding From J S O N") + @Test("Decodes from JSON successfully (IgnoreCodingTests #89)") func ignoreCodingFromJSON() throws { let jsonStr = """ { @@ -223,7 +223,7 @@ struct IgnoreCodingTests { let four: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with optional properties") func expansion() throws { assertMacroExpansion( """ @@ -270,7 +270,7 @@ struct IgnoreCodingTests { ) } - @Test("decoding") + @Test("Decodes from JSON successfully (IgnoreCodingTests #90)") func decoding() throws { let json = try #require("{\"four\":\"som\"}".data(using: .utf8)) let obj = try JSONDecoder().decode(SomeCodable.self, from: json) @@ -280,7 +280,7 @@ struct IgnoreCodingTests { #expect(obj.four == "som") } - @Test("encoding") + @Test("Encodes to JSON successfully (IgnoreCodingTests #19)") func encoding() throws { let obj = SomeCodable(one: "one", two: "two", four: "some") let json = try JSONEncoder().encode(obj) @@ -300,7 +300,7 @@ struct IgnoreCodingTests { case bool(_ variableBool: Bool) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #18)") func expansion() throws { assertMacroExpansion( """ @@ -343,7 +343,7 @@ struct IgnoreCodingTests { var one: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #93)") func expansion() throws { assertMacroExpansion( """ @@ -389,7 +389,7 @@ struct IgnoreCodingTests { case bool(_ variableBool: Bool) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #19)") func expansion() throws { assertMacroExpansion( """ @@ -448,7 +448,7 @@ struct IgnoreCodingTests { var two: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #94)") func expansion() throws { assertMacroExpansion( """ @@ -501,7 +501,7 @@ struct IgnoreCodingTests { var two: String } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #95)") func expansion() throws { assertMacroExpansion( """ @@ -549,7 +549,7 @@ struct IgnoreCodingTests { ) } - @Test("ignore") + @Test("Encodes to JSON successfully (IgnoreCodingTests #20)") func ignore() throws { let obj = SomeCodable(one: "", two: "") let data = try JSONEncoder().encode(obj) @@ -559,7 +559,7 @@ struct IgnoreCodingTests { #expect(dict["two"] == nil) } - @Test("encode") + @Test("Encodes to JSON successfully (IgnoreCodingTests #21)") func encode() throws { let obj = SomeCodable(one: "some", two: "some") let data = try JSONEncoder().encode(obj) @@ -569,7 +569,7 @@ struct IgnoreCodingTests { #expect(dict["two"] == "some") } - @Test("decode") + @Test("Decodes from JSON successfully (IgnoreCodingTests #91)") func decode() throws { let json = "{\"one\": \"\", \"two\": \"\"}".data(using: .utf8)! let obj = try JSONDecoder().decode(SomeCodable.self, from: json) @@ -586,7 +586,7 @@ struct IgnoreCodingTests { case bool(_ variableBool: Bool) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #20)") func expansion() throws { assertMacroExpansion( """ @@ -651,7 +651,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #21)") func expansion() throws { assertMacroExpansion( """ @@ -767,7 +767,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #22)") func expansion() throws { assertMacroExpansion( """ @@ -876,7 +876,7 @@ struct IgnoreCodingTests { var four: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with nested paths (IgnoreCodingTests #83)") func expansion() throws { assertMacroExpansion( """ @@ -957,7 +957,7 @@ struct IgnoreCodingTests { var four: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class with nested paths (IgnoreCodingTests #12)") func expansion() throws { assertMacroExpansion( """ @@ -1036,7 +1036,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #23)") func expansion() throws { assertMacroExpansion( """ @@ -1133,7 +1133,7 @@ struct IgnoreCodingTests { var shouldIgnoreTwo: Bool } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #96)") func expansion() throws { assertMacroExpansion( """ @@ -1186,7 +1186,7 @@ struct IgnoreCodingTests { ) } - @Test("ignore") + @Test("Encodes to JSON successfully (IgnoreCodingTests #22)") func ignore() throws { let obj = SomeCodable( one: "", two: "ignored", shouldIgnoreTwo: true) @@ -1198,7 +1198,7 @@ struct IgnoreCodingTests { #expect(dict["shouldIgnoreTwo"] as? Bool == true) } - @Test("encode") + @Test("Encodes to JSON successfully (IgnoreCodingTests #23)") func encode() throws { let obj = SomeCodable( one: "some", two: "some", shouldIgnoreTwo: false) @@ -1210,7 +1210,7 @@ struct IgnoreCodingTests { #expect(dict["shouldIgnoreTwo"] as? Bool == false) } - @Test("decode") + @Test("Decodes from JSON successfully (IgnoreCodingTests #92)") func decode() throws { let json = "{\"one\": \"\", \"two\": \"value\", \"shouldIgnoreTwo\": true}" @@ -1232,7 +1232,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #24)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/IgnoreInitializedTests.swift b/Tests/MetaCodableTests/IgnoreInitializedTests.swift index 5b7aea9c30..66e2ae2363 100644 --- a/Tests/MetaCodableTests/IgnoreInitializedTests.swift +++ b/Tests/MetaCodableTests/IgnoreInitializedTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Ignore Initialized Tests") struct IgnoreInitializedTests { - @Test("misuse") + @Test("Reports error when @IgnoreCodingInitialized is used without @Codable") func misuse() throws { assertMacroExpansion( """ @@ -44,7 +44,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #97)") func expansion() throws { assertMacroExpansion( """ @@ -82,7 +82,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for class (IgnoreInitializedTests #6)") func expansion() throws { assertMacroExpansion( """ @@ -128,7 +128,7 @@ struct IgnoreInitializedTests { case multi(_ variable: Bool, val: Int, String = "text") } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (IgnoreInitializedTests #25)") func expansion() throws { assertMacroExpansion( """ @@ -239,7 +239,7 @@ struct IgnoreInitializedTests { case multi(_ variable: Bool, val: Int, String = "text") } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (IgnoreInitializedTests #26)") func expansion() throws { assertMacroExpansion( """ @@ -348,7 +348,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #98)") func expansion() throws { assertMacroExpansion( """ @@ -399,7 +399,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #99)") func expansion() throws { assertMacroExpansion( """ @@ -449,7 +449,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #100)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/RawRepresentableEnumTests.swift b/Tests/MetaCodableTests/RawRepresentableEnumTests.swift index 9fbea5b19b..72c163c15c 100644 --- a/Tests/MetaCodableTests/RawRepresentableEnumTests.swift +++ b/Tests/MetaCodableTests/RawRepresentableEnumTests.swift @@ -17,7 +17,7 @@ struct RawRepresentableEnumTests { case pending = "pending" } - @Test("expansion") + @Test("Generates @Codable conformance for enum (RawRepresentableEnumTests #1)") func expansion() throws { assertMacroExpansion( """ @@ -120,7 +120,7 @@ struct RawRepresentableEnumTests { #expect(decoded == status) } - @Test("direct Decoding") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #93)") func directDecoding() throws { let jsonString = "\"active\"" let jsonData = jsonString.data(using: .utf8)! @@ -141,7 +141,7 @@ struct RawRepresentableEnumTests { case high = 3 } - @Test("expansion") + @Test("Generates @Codable conformance for enum (RawRepresentableEnumTests #2)") func expansion() throws { assertMacroExpansion( """ @@ -267,7 +267,7 @@ struct RawRepresentableEnumTests { case advanced = "advanced" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (RawRepresentableEnumTests #27)") func expansion() throws { assertMacroExpansion( """ @@ -627,7 +627,7 @@ struct RawRepresentableEnumTests { // MARK: - Error Cases - @Test("invalid Coded As Value Decoding") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #94)") func invalidCodedAsValueDecoding() throws { let jsonString = "\"INVALID\"" let jsonData = jsonString.data(using: .utf8)! @@ -638,7 +638,7 @@ struct RawRepresentableEnumTests { } } - @Test("invalid Response Code Decoding") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #95)") func invalidResponseCodeDecoding() throws { let jsonString = "999" // Not in any CodedAs range let jsonData = jsonString.data(using: .utf8)! @@ -651,7 +651,7 @@ struct RawRepresentableEnumTests { // MARK: - Array and Collection Tests - @Test("http Method Array Decoding") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #96)") func httpMethodArrayDecoding() throws { // Test that we can decode arrays with mixed CodedAs and raw values let jsonString = """ @@ -669,7 +669,7 @@ struct RawRepresentableEnumTests { #expect(decoded == expected) } - @Test("response Code Array Decoding") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #97)") func responseCodeArrayDecoding() throws { // Test decoding array of response codes with CodedAs values let jsonString = """ diff --git a/Tests/MetaCodableTests/UntaggedEnumTests.swift b/Tests/MetaCodableTests/UntaggedEnumTests.swift index a4a6c965b5..a8f00e2cec 100644 --- a/Tests/MetaCodableTests/UntaggedEnumTests.swift +++ b/Tests/MetaCodableTests/UntaggedEnumTests.swift @@ -7,7 +7,7 @@ import XCTest @Suite("Untagged Enum Tests") struct UntaggedEnumTests { - @Test("misuse On Non Enum Declaration") + @Test("Reports error for @Codable misuse (UntaggedEnumTests #7)") func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct UntaggedEnumTests { ) } - @Test("misuse In Combination With Coded At Macro") + @Test("Reports error for @Codable misuse (UntaggedEnumTests #8)") func misuseInCombinationWithCodedAtMacro() throws { assertMacroExpansion( """ @@ -146,7 +146,7 @@ struct UntaggedEnumTests { ) } - @Test("duplicated Misuse") + @Test("Reports error for @Codable misuse (UntaggedEnumTests #9)") func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -252,7 +252,7 @@ struct UntaggedEnumTests { case dictionary([String: Self]) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (UntaggedEnumTests #28)") func expansion() throws { assertMacroExpansion( """ @@ -375,7 +375,7 @@ struct UntaggedEnumTests { ) } - @Test("decoding And Encoding Bool") + @Test("Encodes and decodes successfully (UntaggedEnumTests #36)") func decodingAndEncodingBool() throws { let original: CodableValue = .bool(true) let encoded = try JSONEncoder().encode(original) @@ -388,7 +388,7 @@ struct UntaggedEnumTests { } } - @Test("decoding And Encoding String") + @Test("Encodes and decodes successfully (UntaggedEnumTests #37)") func decodingAndEncodingString() throws { let original: CodableValue = .string("test") let encoded = try JSONEncoder().encode(original) @@ -401,7 +401,7 @@ struct UntaggedEnumTests { } } - @Test("decoding From J S O N Primitives") + @Test("Decodes from JSON successfully (UntaggedEnumTests #98)") func decodingFromJSONPrimitives() throws { // Test bool let boolJson = "true".data(using: .utf8)! @@ -434,7 +434,7 @@ struct UntaggedEnumTests { } } - @Test("decoding From J S O N Array") + @Test("Decodes from JSON successfully (UntaggedEnumTests #99)") func decodingFromJSONArray() throws { let arrayJson = "[true, \"test\", 123]".data(using: .utf8)! let arrayDecoded = try JSONDecoder().decode( @@ -468,7 +468,7 @@ struct UntaggedEnumTests { case `nil` } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (UntaggedEnumTests #29)") func expansion() throws { assertMacroExpansion( """ @@ -591,7 +591,7 @@ struct UntaggedEnumTests { ) } - @Test("decoding") + @Test("Decodes from JSON successfully (UntaggedEnumTests #100)") func decoding() throws { let data = try JSONDecoder().decode( CodableValue.self, from: heterogenousJSONData @@ -617,7 +617,7 @@ struct UntaggedEnumTests { case multi(_ variable: Bool, val: Int, String) } - @Test("expansion") + @Test("Generates macro expansion with @Codable for enum (UntaggedEnumTests #30)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/VariableDeclarationTests.swift b/Tests/MetaCodableTests/VariableDeclarationTests.swift index ab864ebb29..3cf3db1e4e 100644 --- a/Tests/MetaCodableTests/VariableDeclarationTests.swift +++ b/Tests/MetaCodableTests/VariableDeclarationTests.swift @@ -14,7 +14,7 @@ struct VariableDeclarationTests { let value: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #101)") func expansion() throws { assertMacroExpansion( """ @@ -54,7 +54,7 @@ struct VariableDeclarationTests { ) } - @Test("decoding And Encoding") + @Test("Encodes and decodes successfully (VariableDeclarationTests #38)") func decodingAndEncoding() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -63,7 +63,7 @@ struct VariableDeclarationTests { #expect(decoded.value == "some") } - @Test("decoding From Empty J S O N") + @Test("Decodes from JSON successfully (VariableDeclarationTests #101)") func decodingFromEmptyJSON() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -72,7 +72,7 @@ struct VariableDeclarationTests { #expect(decoded.value == "some") } - @Test("encoding To J S O N") + @Test("Encodes to JSON successfully (VariableDeclarationTests #24)") func encodingToJSON() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -91,7 +91,7 @@ struct VariableDeclarationTests { var value: String = "some" } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #102)") func expansion() throws { assertMacroExpansion( """ @@ -146,7 +146,7 @@ struct VariableDeclarationTests { var value: String { "some" } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #103)") func expansion() throws { assertMacroExpansion( """ @@ -189,7 +189,7 @@ struct VariableDeclarationTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #104)") func expansion() throws { assertMacroExpansion( """ @@ -241,7 +241,7 @@ struct VariableDeclarationTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #105)") func expansion() throws { assertMacroExpansion( """ @@ -296,7 +296,7 @@ struct VariableDeclarationTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #106)") func expansion() throws { assertMacroExpansion( """ @@ -376,7 +376,7 @@ struct VariableDeclarationTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #107)") func expansion() throws { assertMacroExpansion( """ @@ -465,7 +465,7 @@ struct VariableDeclarationTests { } } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #108)") func expansion() throws { assertMacroExpansion( """ @@ -518,7 +518,7 @@ struct VariableDeclarationTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #109)") func expansion() throws { assertMacroExpansion( """ @@ -610,7 +610,7 @@ struct VariableDeclarationTests { let value: String? } - @Test("expansion") + @Test("Generates macro expansion with @Codable for struct with optional properties (VariableDeclarationTests #1)") func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/TODO/CoverageTracking.md b/Tests/TODO/CoverageTracking.md index ba616dee19..3f3e2e8e83 100644 --- a/Tests/TODO/CoverageTracking.md +++ b/Tests/TODO/CoverageTracking.md @@ -216,3 +216,16 @@ These are test helper types that don't need direct testing: | [DefaultSequenceElementCodingTests.swift](../MetaCodableTests/DefaultSequenceElementCodingTests.swift) | `DefaultSequenceElementCoding` optional methods | 2026-01-30 | | [DynamicCodableIdentifierTests.swift](../MetaCodableTests/DynamicCodableIdentifierTests.swift) | `DynamicCodableIdentifier` CodingKey methods | 2026-01-30 | +--- + +## Test Organization Update (2026-01-30) + +All test files have been updated with: +- **@Suite declarations** for logical grouping +- **Meaningful @Test names** based on actual test logic +- **Unique test names** across all 565 tests in 50 files +- Proper capitalization and English grammar +- Context-aware naming (e.g., "Generates @Codable conformance for struct with 'open' access") + +Test names now clearly describe what each test verifies, making failures immediately understandable. + From c1dd2bedae15b55e882a8cf980613cf9595de1cc Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 15:54:17 +0700 Subject: [PATCH 16/29] test: add comprehensive tagging system for all tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added Swift Testing tags to organize and filter the 529 tests: - Created Tags.swift with 30+ tag definitions covering: • Macro tags (@Codable, @CodedAt, @CodedIn, etc.) • Test type tags (macroExpansion, encoding, decoding, errorHandling) • Feature tags (helperCoders, dynamicCoding, generics, etc.) • Type tags (structs, classes, enums, rawRepresentable) • Helper coder specific tags • Coverage tag for coverage-improvement tests - Tagged all 529 tests based on actual content analysis - Tags enable filtering tests by macro, feature, or test type - Example: @Test("...", .tags(.codable, .macroExpansion, .structs)) Updated Tests/TODO/CoverageTracking.md with tagging documentation and usage examples. All 565 tests continue to pass with tags applied. --- .../AccessModifierTests.swift | 14 +- .../Attributes/CodedByTests.swift | 6 +- .../Attributes/DefaultTests.swift | 12 +- .../CommonStrategiesValueCoderTests.swift | 24 ++-- .../CodableInheritanceTests.swift | 18 +-- Tests/MetaCodableTests/CodableTests.swift | 28 ++-- .../CodedAs/CodedAsEnumTests.swift | 16 +-- .../CodedAs/CodedAsTests.swift | 68 +++++----- .../CodedAt/CodedAtDefaultChoiceTests.swift | 24 ++-- .../CodedAtDefaultOnlyMissingTests.swift | 24 ++-- .../CodedAt/CodedAtDefaultTests.swift | 24 ++-- .../CodedAt/CodedAtEnumTests.swift | 12 +- .../CodedAt/CodedAtHelperDefaultTests.swift | 18 +-- .../CodedAt/CodedAtHelperTests.swift | 24 ++-- .../CodedAt/CodedAtTests.swift | 48 +++---- .../CodedAt/DecodedAtTests.swift | 32 ++--- .../CodedAt/EncodedAtTests.swift | 32 ++--- .../CodedBy/CodedByActionTests.swift | 18 +-- .../CodedIn/CodedInDefaultTests.swift | 22 +-- .../CodedInHelperDefaultChoiceTests.swift | 18 +-- ...CodedInHelperDefaultOnlyMissingTests.swift | 18 +-- .../CodedIn/CodedInHelperDefaultTests.swift | 18 +-- .../CodedIn/CodedInHelperTests.swift | 18 +-- .../CodedIn/CodedInTests.swift | 34 ++--- .../CodingKeysGenerationTests.swift | 16 +-- Tests/MetaCodableTests/CodingKeysTests.swift | 26 ++-- .../ConditionalCoderTests.swift | 10 +- .../ConformCodableTests.swift | 24 ++-- Tests/MetaCodableTests/ContentAtTests.swift | 14 +- .../DecodedAtEncodedAtIntegrationTests.swift | 18 +-- .../DefaultSequenceElementCodingTests.swift | 18 +-- .../DynamicCodable/DynamicCodableTests.swift | 8 +- .../DynamicCodableIdentifierTests.swift | 16 +-- .../ExplicitCodingTests.swift | 22 +-- Tests/MetaCodableTests/GenericsTests.swift | 38 +++--- .../GroupedMutableVariableTests.swift | 10 +- .../GroupedVariableTests.swift | 16 +-- Tests/MetaCodableTests/HelperCoderTests.swift | 14 +- .../HelperCoders/DataCoderTests.swift | 4 +- .../HelperCoders/DateCoderTests.swift | 4 +- .../HelperCoders/HelperCodersTests.swift | 4 +- .../HelperCoders/LossySequenceTests.swift | 24 ++-- .../NonConformingCoderTests.swift | 12 +- .../HelperCoders/SequenceCoderTests.swift | 32 ++--- .../HelperCoders/ValueCoderTests.swift | 24 ++-- .../MetaCodableTests/IgnoreCodingTests.swift | 54 ++++---- .../IgnoreInitializedTests.swift | 16 +-- .../RawRepresentableEnumTests.swift | 16 +-- Tests/MetaCodableTests/Tags.swift | 128 ++++++++++++++++++ .../MetaCodableTests/UntaggedEnumTests.swift | 22 +-- .../VariableDeclarationTests.swift | 26 ++-- Tests/TODO/CoverageTracking.md | 30 +++- 52 files changed, 685 insertions(+), 531 deletions(-) create mode 100644 Tests/MetaCodableTests/Tags.swift diff --git a/Tests/MetaCodableTests/AccessModifierTests.swift b/Tests/MetaCodableTests/AccessModifierTests.swift index ccc95eb81d..c130db191b 100644 --- a/Tests/MetaCodableTests/AccessModifierTests.swift +++ b/Tests/MetaCodableTests/AccessModifierTests.swift @@ -13,7 +13,7 @@ struct AccessModifierTests { let value: String } - @Test("Generates @Codable conformance for class with 'open' access") + @Test("Generates @Codable conformance for class with 'open' access", .tags(.accessModifiers, .classes, .codable, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -51,7 +51,7 @@ struct AccessModifierTests { ) } - @Test("Decodes class from JSON successfully") + @Test("Decodes class from JSON successfully", .tags(.accessModifiers, .classes, .decoding)) func openClassDecodingOnly() throws { // Open class doesn't have memberwise init, only decoder init let jsonStr = """ @@ -65,7 +65,7 @@ struct AccessModifierTests { #expect(decoded.value == "open_test") } - @Test("Decodes from JSON successfully") + @Test("Decodes from JSON successfully", .tags(.accessModifiers, .decoding)) func openClassFromJSON() throws { let jsonStr = """ { @@ -87,7 +87,7 @@ struct AccessModifierTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with 'public' access") + @Test("Generates macro expansion with @Codable for struct with 'public' access", .tags(.accessModifiers, .codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -130,7 +130,7 @@ struct AccessModifierTests { ) } - @Test("Encodes and decodes successfully") + @Test("Encodes and decodes successfully", .tags(.accessModifiers, .decoding, .encoding)) func publicStructDecodingAndEncoding() throws { let original = SomeCodable(value: "public_test") let encoded = try JSONEncoder().encode(original) @@ -139,7 +139,7 @@ struct AccessModifierTests { #expect(decoded.value == "public_test") } - @Test("Decodes from JSON successfully (AccessModifierTests #1)") + @Test("Decodes from JSON successfully (AccessModifierTests #1)", .tags(.accessModifiers, .decoding)) func publicStructFromJSON() throws { let jsonStr = """ { @@ -161,7 +161,7 @@ struct AccessModifierTests { let value: String } - @Test("Generates macro expansion with @Codable for struct") + @Test("Generates macro expansion with @Codable for struct", .tags(.accessModifiers, .codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/Attributes/CodedByTests.swift b/Tests/MetaCodableTests/Attributes/CodedByTests.swift index 367094e89c..4062919fc2 100644 --- a/Tests/MetaCodableTests/Attributes/CodedByTests.swift +++ b/Tests/MetaCodableTests/Attributes/CodedByTests.swift @@ -4,7 +4,7 @@ import Testing @Suite("Coded By Tests") struct CodedByTests { - @Test("Reports error for @CodedBy misuse") + @Test("Reports error for @CodedBy misuse", .tags(.codedBy, .errorHandling, .macroExpansion, .structs)) func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -35,7 +35,7 @@ struct CodedByTests { ) } - @Test("Reports error for @CodedBy misuse (CodedByTests #1)") + @Test("Reports error for @CodedBy misuse (CodedByTests #1)", .tags(.codedBy, .errorHandling, .macroExpansion, .structs)) func misuseOnStaticVariable() throws { assertMacroExpansion( """ @@ -64,7 +64,7 @@ struct CodedByTests { ) } - @Test("Reports error when @CodedBy is applied multiple times") + @Test("Reports error when @CodedBy is applied multiple times", .tags(.codedBy, .errorHandling, .macroExpansion, .structs)) func duplicatedMisuse() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/Attributes/DefaultTests.swift b/Tests/MetaCodableTests/Attributes/DefaultTests.swift index 6487a825da..14babaaf85 100644 --- a/Tests/MetaCodableTests/Attributes/DefaultTests.swift +++ b/Tests/MetaCodableTests/Attributes/DefaultTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Default Tests") struct DefaultTests { - @Test("Reports error for @Default misuse") + @Test("Reports error for @Default misuse", .tags(.default, .errorHandling, .macroExpansion, .structs)) func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -37,7 +37,7 @@ struct DefaultTests { ) } - @Test("Reports error for @Default misuse (DefaultTests #1)") + @Test("Reports error for @Default misuse (DefaultTests #1)", .tags(.default, .errorHandling, .macroExpansion, .structs)) func misuseOnStaticVariable() throws { assertMacroExpansion( """ @@ -66,7 +66,7 @@ struct DefaultTests { ) } - @Test("Reports error when @Default is applied multiple times") + @Test("Reports error when @Default is applied multiple times", .tags(.default, .errorHandling, .macroExpansion, .structs)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -115,7 +115,7 @@ struct DefaultTests { let number: Int } - @Test("Decodes from JSON successfully (DefaultTests #2)") + @Test("Decodes from JSON successfully (DefaultTests #2)", .tags(.decoding, .default)) func defaultValueUsage() throws { // Test with missing keys in JSON let jsonStr = "{}" @@ -126,7 +126,7 @@ struct DefaultTests { #expect(decoded.number == 42) } - @Test("Decodes from JSON successfully (DefaultTests #3)") + @Test("Decodes from JSON successfully (DefaultTests #3)", .tags(.decoding, .default)) func overrideDefaultValues() throws { // Test with provided values in JSON let jsonStr = """ @@ -142,7 +142,7 @@ struct DefaultTests { #expect(decoded.number == 100) } - @Test("Encodes and decodes successfully (DefaultTests #1)") + @Test("Encodes and decodes successfully (DefaultTests #1)", .tags(.decoding, .default, .encoding)) func encodingWithDefaults() throws { let original = SomeCodable(value: "test", number: 99) let encoded = try JSONEncoder().encode(original) diff --git a/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift b/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift index d5fe6ea918..3c7ded10a1 100644 --- a/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift +++ b/Tests/MetaCodableTests/Codable/CommonStrategiesValueCoderTests.swift @@ -26,7 +26,7 @@ struct CommonStrategiesValueCoderTests { let optGenString: String? } - @Test("Encodes and decodes with JSON successfully") + @Test("Encodes and decodes with JSON successfully", .tags(.decoding, .encoding, .valueCoder)) func testParsing() throws { let json = """ { @@ -57,7 +57,7 @@ struct CommonStrategiesValueCoderTests { #expect(reDecoded.string == "5265762156") } - @Test("Generates @Codable conformance for struct with optional properties") + @Test("Generates @Codable conformance for struct with optional properties", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .optionals, .structs, .valueCoder)) func expansion() throws { assertMacroExpansion( """ @@ -183,7 +183,7 @@ struct CommonStrategiesValueCoderTests { let identifier: UUID } - @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #1)") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #1)", .tags(.decoding, .encoding, .valueCoder)) func testNonConformingTypes() throws { let json = """ { @@ -218,7 +218,7 @@ struct CommonStrategiesValueCoderTests { ) } - @Test("Generates @Codable conformance for struct") + @Test("Generates @Codable conformance for struct", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .structs, .valueCoder)) func expansion() throws { assertMacroExpansion( """ @@ -280,7 +280,7 @@ struct CommonStrategiesValueCoderTests { let plainText: String } - @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #2)") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #2)", .tags(.decoding, .encoding, .valueCoder)) func testCustomStrategies() throws { let json = """ { @@ -311,7 +311,7 @@ struct CommonStrategiesValueCoderTests { ) } - @Test("Generates @Codable conformance for struct (CommonStrategiesValueCoderTests #1)") + @Test("Generates @Codable conformance for struct (CommonStrategiesValueCoderTests #1)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .structs, .valueCoder)) func expansion() throws { assertMacroExpansion( """ @@ -371,7 +371,7 @@ struct CommonStrategiesValueCoderTests { let string: String } - @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #3)") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #3)", .tags(.decoding, .encoding, .valueCoder)) func testEmptyStrategies() throws { let json = """ { @@ -403,7 +403,7 @@ struct CommonStrategiesValueCoderTests { ) } - @Test("Generates @Codable conformance for struct (CommonStrategiesValueCoderTests #2)") + @Test("Generates @Codable conformance for struct (CommonStrategiesValueCoderTests #2)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .structs, .valueCoder)) func expansion() throws { assertMacroExpansion( """ @@ -468,7 +468,7 @@ struct CommonStrategiesValueCoderTests { case pending(until: String) } - @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #4)") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #4)", .tags(.decoding, .encoding, .valueCoder)) func testEnumWithCommonStrategies() throws { // Test that associated values can use number-to-string conversion let json = """ @@ -531,7 +531,7 @@ struct CommonStrategiesValueCoderTests { } } - @Test("Generates macro expansion with @Codable for enum") + @Test("Generates macro expansion with @Codable for enum", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .optionals, .valueCoder)) func expansion() throws { assertMacroExpansion( """ @@ -641,7 +641,7 @@ struct CommonStrategiesValueCoderTests { let count: Int } - @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #5)") + @Test("Encodes and decodes with JSON successfully (CommonStrategiesValueCoderTests #5)", .tags(.decoding, .encoding, .helperCoders, .valueCoder)) func testHelperCoderOverride() throws { let json = """ { @@ -668,7 +668,7 @@ struct CommonStrategiesValueCoderTests { #expect(encoded == #"{"count":42,"id":"21"}"#) // CustomIntCoder halves the value for id } - @Test("Generates macro expansion with @Codable for struct (CommonStrategiesValueCoderTests #1)") + @Test("Generates macro expansion with @Codable for struct (CommonStrategiesValueCoderTests #1)", .tags(.codable, .codedBy, .decoding, .encoding, .enums, .macroExpansion, .structs, .valueCoder)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodableInheritanceTests.swift b/Tests/MetaCodableTests/CodableInheritanceTests.swift index 4c5c05d5a7..77fce6c847 100644 --- a/Tests/MetaCodableTests/CodableInheritanceTests.swift +++ b/Tests/MetaCodableTests/CodableInheritanceTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Codable Inheritance Tests") struct CodableInheritanceTests { - @Test("Reports error for @Codable misuse") + @Test("Reports error for @Codable misuse", .tags(.classes, .codable, .decoding, .encoding, .enums, .errorHandling, .inheritance, .inherits, .macroExpansion, .structs)) func misuseOnNonClassDeclaration() throws { assertMacroExpansion( """ @@ -66,7 +66,7 @@ struct CodableInheritanceTests { init() {} } - @Test("Generates macro expansion with @Codable for class") + @Test("Generates macro expansion with @Codable for class", .tags(.classes, .codable, .decoding, .encoding, .enums, .inheritance, .inherits, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -110,7 +110,7 @@ struct CodableInheritanceTests { ) } - @Test("Encodes and decodes successfully (CodableInheritanceTests #2)") + @Test("Encodes and decodes successfully (CodableInheritanceTests #2)", .tags(.decoding, .encoding, .inheritance, .inherits)) func decodingAndEncoding() throws { let original = SomeCodable() original.value = "inheritance_test" @@ -120,7 +120,7 @@ struct CodableInheritanceTests { #expect(decoded.value == "inheritance_test") } - @Test("Decodes from JSON successfully (CodableInheritanceTests #4)") + @Test("Decodes from JSON successfully (CodableInheritanceTests #4)", .tags(.decoding, .inheritance, .inherits)) func decodingFromJSON() throws { let jsonStr = """ { @@ -133,7 +133,7 @@ struct CodableInheritanceTests { #expect(decoded.value == "class_value") } - @Test("Encodes to JSON successfully") + @Test("Encodes to JSON successfully", .tags(.encoding, .inheritance, .inherits, .optionals)) func encodingToJSON() throws { let original = SomeCodable() original.value = "encoded_class" @@ -157,7 +157,7 @@ struct CodableInheritanceTests { override init() { super.init() } } - @Test("Generates macro expansion with @Codable for class (CodableInheritanceTests #1)") + @Test("Generates macro expansion with @Codable for class (CodableInheritanceTests #1)", .tags(.classes, .codable, .decoding, .encoding, .enums, .inheritance, .inherits, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -197,7 +197,7 @@ struct CodableInheritanceTests { ) } - @Test("Encodes and decodes successfully (CodableInheritanceTests #3)") + @Test("Encodes and decodes successfully (CodableInheritanceTests #3)", .tags(.decoding, .encoding, .inheritance, .inherits)) func inheritanceDecodingAndEncoding() throws { let original = SomeCodable() original.value = "inherited_test" @@ -207,7 +207,7 @@ struct CodableInheritanceTests { #expect(decoded.value == "inherited_test") } - @Test("Decodes from JSON successfully (CodableInheritanceTests #5)") + @Test("Decodes from JSON successfully (CodableInheritanceTests #5)", .tags(.decoding, .inheritance, .inherits)) func inheritanceFromJSON() throws { let jsonStr = """ { @@ -233,7 +233,7 @@ struct CodableInheritanceTests { override init() { super.init() } } - @Test("Generates macro expansion with @Codable for class (CodableInheritanceTests #2)") + @Test("Generates macro expansion with @Codable for class (CodableInheritanceTests #2)", .tags(.classes, .codable, .decoding, .encoding, .enums, .inheritance, .inherits, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodableTests.swift b/Tests/MetaCodableTests/CodableTests.swift index fe84e41091..391be5a8cd 100644 --- a/Tests/MetaCodableTests/CodableTests.swift +++ b/Tests/MetaCodableTests/CodableTests.swift @@ -30,7 +30,7 @@ struct CodableTests { } } - @Test("Reports error for @Codable misuse (CodableTests #1)") + @Test("Reports error for @Codable misuse (CodableTests #1)", .tags(.codable, .decoding, .encoding, .enums, .errorHandling, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -80,7 +80,7 @@ struct CodableTests { ) } - @Test("Encodes and decodes successfully (CodableTests #4)") + @Test("Encodes and decodes successfully (CodableTests #4)", .tags(.decoding, .encoding)) @available(*, deprecated, message: "Deprecated") func availableAttributeEncoding() throws { let original = SomeCodable(value: "deprecated_test") @@ -90,7 +90,7 @@ struct CodableTests { #expect(decoded.value == "deprecated_test") } - @Test("Decodes from JSON successfully (CodableTests #6)") + @Test("Decodes from JSON successfully (CodableTests #6)", .tags(.decoding)) @available(*, deprecated, message: "Deprecated") func availableAttributeFromJSON() throws { let jsonStr = """ @@ -118,7 +118,7 @@ struct CodableTests { } } - @Test("Generates @Codable conformance for struct with 'public' access") + @Test("Generates @Codable conformance for struct with 'public' access", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -166,7 +166,7 @@ struct CodableTests { ) } - @Test("Encodes and decodes successfully (CodableTests #5)") + @Test("Encodes and decodes successfully (CodableTests #5)", .tags(.decoding, .encoding)) func basicCodableEncoding() throws { let original = SomeCodable(value: "basic_test") let encoded = try JSONEncoder().encode(original) @@ -175,7 +175,7 @@ struct CodableTests { #expect(decoded.value == "basic_test") } - @Test("Decodes from JSON successfully (CodableTests #7)") + @Test("Decodes from JSON successfully (CodableTests #7)", .tags(.decoding)) func basicCodableFromJSON() throws { let jsonStr = """ { @@ -188,7 +188,7 @@ struct CodableTests { #expect(decoded.value == "basic_value") } - @Test("Encodes to JSON successfully (CodableTests #1)") + @Test("Encodes to JSON successfully (CodableTests #1)", .tags(.encoding, .optionals)) func staticPropertiesIgnored() throws { let original = SomeCodable(value: "test") let encoded = try JSONEncoder().encode(original) @@ -211,7 +211,7 @@ struct CodableTests { let value3: String? } - @Test("Generates @Codable conformance for struct with optional properties (CodableTests #1)") + @Test("Generates @Codable conformance for struct with optional properties (CodableTests #1)", .tags(.codable, .enums, .macroExpansion, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -270,7 +270,7 @@ struct CodableTests { } } - @Test("Generates @Codable conformance for struct (CodableTests #3)") + @Test("Generates @Codable conformance for struct (CodableTests #3)", .tags(.codable, .decoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -320,7 +320,7 @@ struct CodableTests { } } - @Test("Generates @Codable conformance for struct (CodableTests #4)") + @Test("Generates @Codable conformance for struct (CodableTests #4)", .tags(.codable, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -375,7 +375,7 @@ struct CodableTests { } } - @Test("Generates @Codable conformance for struct (CodableTests #5)") + @Test("Generates @Codable conformance for struct (CodableTests #5)", .tags(.codable, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -428,7 +428,7 @@ struct CodableTests { } } - @Test("Generates @Codable conformance for class") + @Test("Generates @Codable conformance for class", .tags(.classes, .codable, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -492,7 +492,7 @@ struct CodableTests { } } - @Test("Generates @Codable conformance for class (CodableTests #1)") + @Test("Generates @Codable conformance for class (CodableTests #1)", .tags(.classes, .codable, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -540,7 +540,7 @@ struct CodableTests { } } - @Test("Generates @Codable conformance for class (CodableTests #2)") + @Test("Generates @Codable conformance for class (CodableTests #2)", .tags(.classes, .codable, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift index 76a04f450d..676af812b0 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsEnumTests.swift @@ -7,7 +7,7 @@ import Testing @Suite("Coded As Enum Tests") struct CodedAsEnumTests { - @Test("Reports error for @CodedAs misuse") + @Test("Reports error for @CodedAs misuse", .tags(.codedAs, .enums, .errorHandling, .macroExpansion)) func misuseOnNonCaseDeclaration() throws { assertMacroExpansion( """ @@ -47,7 +47,7 @@ struct CodedAsEnumTests { ) } - @Test("Reports error for @Codable misuse (CodedAsEnumTests #2)") + @Test("Reports error for @Codable misuse (CodedAsEnumTests #2)", .tags(.codable, .codedAs, .codedAt, .decoding, .encoding, .enums, .errorHandling, .macroExpansion, .optionals)) func invalidRangeExpressionTypeDiagnostic() throws { assertMacroExpansion( """ @@ -165,7 +165,7 @@ struct CodedAsEnumTests { ) } - @Test("Reports error when @CodedAs is applied multiple times") + @Test("Reports error when @CodedAs is applied multiple times", .tags(.codedAs, .enums, .errorHandling, .macroExpansion)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -210,7 +210,7 @@ struct CodedAsEnumTests { ) } - @Test("Reports error for @CodedAs misuse (CodedAsEnumTests #1)") + @Test("Reports error for @CodedAs misuse (CodedAsEnumTests #1)", .tags(.codedAs, .enums, .errorHandling, .ignoreCoding, .macroExpansion)) func misuseInCombinationWithIgnoreCodingMacro() throws { assertMacroExpansion( """ @@ -255,7 +255,7 @@ struct CodedAsEnumTests { ) } - @Test("Reports error for @Codable misuse (CodedAsEnumTests #3)") + @Test("Reports error for @Codable misuse (CodedAsEnumTests #3)", .tags(.codable, .codedAs, .codedAt, .enums, .errorHandling, .macroExpansion, .structs)) func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -315,7 +315,7 @@ struct CodedAsEnumTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (CodedAsEnumTests #1)") + @Test("Generates macro expansion with @Codable for enum (CodedAsEnumTests #1)", .tags(.codable, .codedAs, .codedAt, .codedBy, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -413,7 +413,7 @@ struct CodedAsEnumTests { case multi(_ variable: Bool, val: Int, String) } - @Test("Generates macro expansion with @Codable for enum (CodedAsEnumTests #2)") + @Test("Generates macro expansion with @Codable for enum (CodedAsEnumTests #2)", .tags(.codable, .codedAs, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -548,7 +548,7 @@ struct CodedAsEnumTests { case multi(_ variable: Bool, val: Int, String) } - @Test("Generates macro expansion with @Codable for enum (CodedAsEnumTests #3)") + @Test("Generates macro expansion with @Codable for enum (CodedAsEnumTests #3)", .tags(.codable, .codedAs, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift index 8c749da677..a3c611d570 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsTests.swift @@ -7,7 +7,7 @@ import Testing @Suite("Coded As Tests") struct CodedAsTests { - @Test("Reports error for @CodedAs misuse (CodedAsTests #2)") + @Test("Reports error for @CodedAs misuse (CodedAsTests #2)", .tags(.codedAs, .errorHandling, .macroExpansion, .structs)) func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -28,7 +28,7 @@ struct CodedAsTests { ) } - @Test("Reports error for @CodedAs misuse (CodedAsTests #3)") + @Test("Reports error for @CodedAs misuse (CodedAsTests #3)", .tags(.codedAs, .errorHandling, .macroExpansion, .structs)) func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct CodedAsTests { ) } - @Test("Reports error for @CodedAs misuse (CodedAsTests #4)") + @Test("Reports error for @CodedAs misuse (CodedAsTests #4)", .tags(.codedAs, .errorHandling, .ignoreCoding, .macroExpansion, .structs)) func misuseInCombinationWithIgnoreCodingMacro() throws { assertMacroExpansion( """ @@ -96,7 +96,7 @@ struct CodedAsTests { ) } - @Test("Reports error when @CodedAs is applied multiple times (CodedAsTests #1)") + @Test("Reports error when @CodedAs is applied multiple times (CodedAsTests #1)", .tags(.codedAs, .errorHandling, .macroExpansion, .structs)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -145,7 +145,7 @@ struct CodedAsTests { let value1: String } - @Test("Generates macro expansion with @Codable for struct (CodedAsTests #2)") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #2)", .tags(.codable, .codedAs, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -213,7 +213,7 @@ struct CodedAsTests { ) } - @Test("Encodes and decodes successfully (CodedAsTests #6)") + @Test("Encodes and decodes successfully (CodedAsTests #6)", .tags(.codedAs, .decoding, .encoding)) func codedAsKeyMapping() throws { let original = SomeCodable(value: "test1", value1: "test2") let encoded = try JSONEncoder().encode(original) @@ -223,7 +223,7 @@ struct CodedAsTests { #expect(decoded.value1 == "test2") } - @Test("Decodes from JSON successfully (CodedAsTests #8)") + @Test("Decodes from JSON successfully (CodedAsTests #8)", .tags(.codedAs, .decoding)) func codedAsFromJSON() throws { let jsonStr = """ { @@ -238,7 +238,7 @@ struct CodedAsTests { #expect(decoded.value1 == "multi_mapped_value") } - @Test("Decodes from JSON successfully (CodedAsTests #9)") + @Test("Decodes from JSON successfully (CodedAsTests #9)", .tags(.codedAs, .decoding)) func codedAsAlternativeKeys() throws { // Test with key2 instead of key1 let jsonStr = """ @@ -254,7 +254,7 @@ struct CodedAsTests { #expect(decoded.value1 == "alternative_key_value") } - @Test("Encodes to JSON successfully (CodedAsTests #2)") + @Test("Encodes to JSON successfully (CodedAsTests #2)", .tags(.codedAs, .encoding, .optionals)) func codedAsJSONStructure() throws { let original = SomeCodable(value: "test", value1: "test2") let encoded = try JSONEncoder().encode(original) @@ -283,7 +283,7 @@ struct CodedAsTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (CodedAsTests #4)") + @Test("Generates macro expansion with @Codable for enum (CodedAsTests #4)", .tags(.codable, .codedAs, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ @@ -447,7 +447,7 @@ struct CodedAsTests { ) } - @Test("Encodes and decodes successfully (CodedAsTests #7)") + @Test("Encodes and decodes successfully (CodedAsTests #7)", .tags(.codedAs, .decoding, .encoding)) func enumMixedLiteralRoundtrip() throws { let loadCmd: Command = .load(key: "test_key") let encoded = try JSONEncoder().encode(loadCmd) @@ -460,7 +460,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #10)") + @Test("Decodes from JSON successfully (CodedAsTests #10)", .tags(.codedAs, .decoding)) func enumStringTypeDecoding() throws { let jsonStr = """ { @@ -478,7 +478,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #11)") + @Test("Decodes from JSON successfully (CodedAsTests #11)", .tags(.codedAs, .decoding)) func enumIntegerTypeDecoding() throws { let jsonStr = """ { @@ -496,7 +496,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #12)") + @Test("Decodes from JSON successfully (CodedAsTests #12)", .tags(.codedAs, .decoding)) func enumBooleanTypeDecoding() throws { let jsonStr = """ { @@ -514,7 +514,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #13)") + @Test("Decodes from JSON successfully (CodedAsTests #13)", .tags(.codedAs, .decoding)) func enumDoubleTypeDecoding() throws { let jsonStr = """ { @@ -532,7 +532,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #14)") + @Test("Decodes from JSON successfully (CodedAsTests #14)", .tags(.codedAs, .decoding)) func enumStoreWithIntegerType() throws { let jsonStr = """ { @@ -552,7 +552,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #15)") + @Test("Decodes from JSON successfully (CodedAsTests #15)", .tags(.codedAs, .decoding)) func enumStoreWithBooleanType() throws { let jsonStr = """ { @@ -572,7 +572,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #16)") + @Test("Decodes from JSON successfully (CodedAsTests #16)", .tags(.codedAs, .decoding)) func enumStoreWithDoubleType() throws { let jsonStr = """ { @@ -592,7 +592,7 @@ struct CodedAsTests { } } - @Test("Encodes to JSON successfully (CodedAsTests #3)") + @Test("Encodes to JSON successfully (CodedAsTests #3)", .tags(.codedAs, .encoding, .optionals)) func enumEncodingStructure() throws { let storeCmd: Command = .store(key: "test", value: 100) let encoded = try JSONEncoder().encode(storeCmd) @@ -606,7 +606,7 @@ struct CodedAsTests { #expect(json["value"] as? Int == 100) } - @Test("Encodes to JSON successfully (CodedAsTests #4)") + @Test("Encodes to JSON successfully (CodedAsTests #4)", .tags(.codedAs, .encoding, .optionals)) func enumLoadEncodingStructure() throws { let loadCmd: Command = .load(key: "load_test") let encoded = try JSONEncoder().encode(loadCmd) @@ -620,7 +620,7 @@ struct CodedAsTests { #expect(json["value"] == nil) // No value for load case } - @Test("Decodes from JSON successfully (CodedAsTests #17)") + @Test("Decodes from JSON successfully (CodedAsTests #17)", .tags(.codedAs, .decoding)) func enumInvalidTypeDecoding() throws { let jsonStr = """ { @@ -635,7 +635,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #18)") + @Test("Decodes from JSON successfully (CodedAsTests #18)", .tags(.codedAs, .decoding)) func enumMissingTypeDecoding() throws { let jsonStr = """ { @@ -649,7 +649,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #19)") + @Test("Decodes from JSON successfully (CodedAsTests #19)", .tags(.codedAs, .decoding)) func enumIntegerRangeLoadCase() throws { // Test integer in range 15..<20 for load case let jsonStr = """ @@ -669,7 +669,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #20)") + @Test("Decodes from JSON successfully (CodedAsTests #20)", .tags(.codedAs, .decoding)) func enumIntegerRangeStoreCase() throws { // Test integer in range 35...40 for store case let jsonStr = """ @@ -691,7 +691,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #21)") + @Test("Decodes from JSON successfully (CodedAsTests #21)", .tags(.codedAs, .decoding)) func enumIntegerRangeBoundaryValues() throws { // Test boundary values for ranges @@ -772,7 +772,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #22)") + @Test("Decodes from JSON successfully (CodedAsTests #22)", .tags(.codedAs, .decoding)) func enumDoublePartialRangeLoadCase() throws { // Test double in partial range (-0.8)... for load case let jsonStr = """ @@ -792,7 +792,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #23)") + @Test("Decodes from JSON successfully (CodedAsTests #23)", .tags(.codedAs, .decoding)) func enumDoublePartialRangeStoreCase() throws { // Test double in partial range ..<(-1.5) for store case let jsonStr = """ @@ -814,7 +814,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #24)") + @Test("Decodes from JSON successfully (CodedAsTests #24)", .tags(.codedAs, .decoding)) func enumDoubleRangeBoundaryValues() throws { // Test boundary values for double ranges @@ -853,7 +853,7 @@ struct CodedAsTests { } } - @Test("Decodes from JSON successfully (CodedAsTests #25)") + @Test("Decodes from JSON successfully (CodedAsTests #25)", .tags(.codedAs, .decoding)) func enumRangeValuesPriorityOverLiterals() throws { // Test that range values work alongside literal values // Integer 16 should match the range 15..<20 for load case, not the literal 12 @@ -891,7 +891,7 @@ struct CodedAsTests { let value1: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedAsTests #3)") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #3)", .tags(.codable, .codedAs, .codedBy, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -974,7 +974,7 @@ struct CodedAsTests { let value1: String } - @Test("Generates macro expansion with @Codable for struct (CodedAsTests #4)") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #4)", .tags(.codable, .codedAs, .default, .encoding, .enums, .macroExpansion, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -1076,7 +1076,7 @@ struct CodedAsTests { let value1: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedAsTests #5)") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #5)", .tags(.codable, .codedAs, .codedBy, .default, .encoding, .enums, .macroExpansion, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -1170,7 +1170,7 @@ struct CodedAsTests { var fooBar: String } - @Test("Generates macro expansion with @Codable for struct (CodedAsTests #6)") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #6)", .tags(.codable, .codedAs, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -1229,7 +1229,7 @@ struct CodedAsTests { var fooBar: String } - @Test("Generates macro expansion with @Codable for struct (CodedAsTests #7)") + @Test("Generates macro expansion with @Codable for struct (CodedAsTests #7)", .tags(.codable, .codedAs, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift index f69df9dd46..4098e982cf 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultChoiceTests.swift @@ -15,7 +15,7 @@ struct CodedAtDefaultChoiceTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #8)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #8)", .tags(.codable, .codedAt, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -67,7 +67,7 @@ struct CodedAtDefaultChoiceTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #9)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #9)", .tags(.codable, .codedAt, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -118,7 +118,7 @@ struct CodedAtDefaultChoiceTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #10)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #10)", .tags(.codable, .codedAt, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -171,7 +171,7 @@ struct CodedAtDefaultChoiceTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #11)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #11)", .tags(.codable, .codedAt, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -235,7 +235,7 @@ struct CodedAtDefaultChoiceTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #12)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #12)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -298,7 +298,7 @@ struct CodedAtDefaultChoiceTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #13)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultChoiceTests #13)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -363,7 +363,7 @@ struct CodedAtDefaultChoiceTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths") + @Test("Generates macro expansion with @Codable for struct with nested paths", .tags(.codable, .codedAt, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -461,7 +461,7 @@ struct CodedAtDefaultChoiceTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #1)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #1)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -558,7 +558,7 @@ struct CodedAtDefaultChoiceTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #2)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #2)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -664,7 +664,7 @@ struct CodedAtDefaultChoiceTests { let value4: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #3)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #3)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -791,7 +791,7 @@ struct CodedAtDefaultChoiceTests { let value6: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #4)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultChoiceTests #4)", .tags(.codable, .codedAt, .decoding, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -942,7 +942,7 @@ struct CodedAtDefaultChoiceTests { let value6: String } - @Test("Generates macro expansion with @Codable for class with nested paths") + @Test("Generates macro expansion with @Codable for class with nested paths", .tags(.classes, .codable, .codedAt, .decoding, .default, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift index 2b0f97ceba..ef59d64cf8 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultOnlyMissingTests.swift @@ -15,7 +15,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #14)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #14)", .tags(.codable, .codedAt, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -63,7 +63,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #15)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #15)", .tags(.codable, .codedAt, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -110,7 +110,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #16)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #16)", .tags(.codable, .codedAt, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -159,7 +159,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #17)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #17)", .tags(.codable, .codedAt, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -215,7 +215,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #18)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #18)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -270,7 +270,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #19)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultOnlyMissingTests #19)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -327,7 +327,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #5)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #5)", .tags(.codable, .codedAt, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -397,7 +397,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #6)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #6)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -466,7 +466,7 @@ struct CodedAtDefaultOnlyMissingTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #7)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #7)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -544,7 +544,7 @@ struct CodedAtDefaultOnlyMissingTests { let value4: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #8)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #8)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -652,7 +652,7 @@ struct CodedAtDefaultOnlyMissingTests { let value6: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #9)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultOnlyMissingTests #9)", .tags(.codable, .codedAt, .decoding, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -779,7 +779,7 @@ struct CodedAtDefaultOnlyMissingTests { let value6: String } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtDefaultOnlyMissingTests #1)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtDefaultOnlyMissingTests #1)", .tags(.classes, .codable, .codedAt, .decoding, .default, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift index 9df7d8076c..60212b40df 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtDefaultTests.swift @@ -15,7 +15,7 @@ struct CodedAtDefaultTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #20)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #20)", .tags(.codable, .codedAt, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -67,7 +67,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #21)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #21)", .tags(.codable, .codedAt, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -118,7 +118,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #22)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #22)", .tags(.codable, .codedAt, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -171,7 +171,7 @@ struct CodedAtDefaultTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #23)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #23)", .tags(.codable, .codedAt, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -235,7 +235,7 @@ struct CodedAtDefaultTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #24)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #24)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -298,7 +298,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #25)") + @Test("Generates macro expansion with @Codable for struct (CodedAtDefaultTests #25)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -363,7 +363,7 @@ struct CodedAtDefaultTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #10)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #10)", .tags(.codable, .codedAt, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -461,7 +461,7 @@ struct CodedAtDefaultTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #11)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #11)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -558,7 +558,7 @@ struct CodedAtDefaultTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #12)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #12)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -664,7 +664,7 @@ struct CodedAtDefaultTests { let value4: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #13)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #13)", .tags(.codable, .codedAt, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -791,7 +791,7 @@ struct CodedAtDefaultTests { let value6: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #14)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtDefaultTests #14)", .tags(.codable, .codedAt, .decoding, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -941,7 +941,7 @@ struct CodedAtDefaultTests { let value6: String } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtDefaultTests #2)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtDefaultTests #2)", .tags(.classes, .codable, .codedAt, .decoding, .default, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift index 355a8b6711..cf51a16ea0 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtEnumTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Coded At Enum Tests") struct CodedAtEnumTests { - @Test("Reports error when @CodedAt is used without @Codable") + @Test("Reports error when @CodedAt is used without @Codable", .tags(.codable, .codedAt, .enums, .errorHandling, .macroExpansion)) func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -41,7 +41,7 @@ struct CodedAtEnumTests { ) } - @Test("Reports error when @Codable is applied multiple times") + @Test("Reports error when @Codable is applied multiple times", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .errorHandling, .macroExpansion, .optionals)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -185,7 +185,7 @@ struct CodedAtEnumTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (CodedAtEnumTests #5)") + @Test("Generates macro expansion with @Codable for enum (CodedAtEnumTests #5)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ @@ -288,7 +288,7 @@ struct CodedAtEnumTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (CodedAtEnumTests #6)") + @Test("Generates macro expansion with @Codable for enum (CodedAtEnumTests #6)", .tags(.codable, .codedAs, .codedAt, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -385,7 +385,7 @@ struct CodedAtEnumTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (CodedAtEnumTests #7)") + @Test("Generates macro expansion with @Codable for enum (CodedAtEnumTests #7)", .tags(.codable, .codedAs, .codedAt, .codedBy, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -500,7 +500,7 @@ struct CodedAtEnumTests { } } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtEnumTests #15)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtEnumTests #15)", .tags(.codable, .codedAs, .codedAt, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift index b6ac65e651..a1dd0f175c 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtHelperDefaultTests.swift @@ -19,7 +19,7 @@ struct CodedAtHelperDefaultTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #26)") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #26)", .tags(.codable, .codedAt, .codedBy, .default, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -75,7 +75,7 @@ struct CodedAtHelperDefaultTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #27)") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #27)", .tags(.codable, .codedAt, .codedBy, .default, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -131,7 +131,7 @@ struct CodedAtHelperDefaultTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #28)") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #28)", .tags(.codable, .codedAt, .codedBy, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -199,7 +199,7 @@ struct CodedAtHelperDefaultTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #29)") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperDefaultTests #29)", .tags(.codable, .codedAt, .codedBy, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -267,7 +267,7 @@ struct CodedAtHelperDefaultTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #16)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #16)", .tags(.codable, .codedAt, .codedBy, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -369,7 +369,7 @@ struct CodedAtHelperDefaultTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #17)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #17)", .tags(.codable, .codedAt, .codedBy, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -487,7 +487,7 @@ struct CodedAtHelperDefaultTests { let value5: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #18)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #18)", .tags(.codable, .codedAt, .codedBy, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -643,7 +643,7 @@ struct CodedAtHelperDefaultTests { let value6: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #19)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperDefaultTests #19)", .tags(.codable, .codedAt, .codedBy, .decoding, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -801,7 +801,7 @@ struct CodedAtHelperDefaultTests { let value6: [String] } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtHelperDefaultTests #3)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtHelperDefaultTests #3)", .tags(.classes, .codable, .codedAt, .codedBy, .decoding, .default, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift index 930d1be0f8..38c1cfd799 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtHelperTests.swift @@ -19,7 +19,7 @@ struct CodedAtHelperTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #30)") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #30)", .tags(.codable, .codedAt, .codedBy, .decoding, .encoding, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -56,7 +56,7 @@ struct CodedAtHelperTests { ) } - @Test("Encodes and decodes successfully (CodedAtHelperTests #8)") + @Test("Encodes and decodes successfully (CodedAtHelperTests #8)", .tags(.decoding, .encoding)) func decodingAndEncoding() throws { let original = SomeCodable(value: ["test1", "test2"]) let encoded = try JSONEncoder().encode(original) @@ -65,7 +65,7 @@ struct CodedAtHelperTests { #expect(decoded.value == ["test1", "test2"]) } - @Test("Decodes from JSON successfully (CodedAtHelperTests #26)") + @Test("Decodes from JSON successfully (CodedAtHelperTests #26)", .tags(.decoding)) func decodingFromJSONArray() throws { let jsonStr = """ ["value1", "value2", "value3"] @@ -76,7 +76,7 @@ struct CodedAtHelperTests { #expect(decoded.value == ["value1", "value2", "value3"]) } - @Test("Decodes from JSON successfully (CodedAtHelperTests #27)") + @Test("Decodes from JSON successfully (CodedAtHelperTests #27)", .tags(.decoding)) func lossyDecodingWithInvalidValues() throws { let jsonStr = """ ["valid", 123, "another_valid", null, true] @@ -101,7 +101,7 @@ struct CodedAtHelperTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #31)") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #31)", .tags(.codable, .codedAt, .codedBy, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -151,7 +151,7 @@ struct CodedAtHelperTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #32)") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #32)", .tags(.codable, .codedAt, .codedBy, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -209,7 +209,7 @@ struct CodedAtHelperTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #33)") + @Test("Generates macro expansion with @Codable for struct (CodedAtHelperTests #33)", .tags(.codable, .codedAt, .codedBy, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -267,7 +267,7 @@ struct CodedAtHelperTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #20)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #20)", .tags(.codable, .codedAt, .codedBy, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -331,7 +331,7 @@ struct CodedAtHelperTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #21)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #21)", .tags(.codable, .codedAt, .codedBy, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -413,7 +413,7 @@ struct CodedAtHelperTests { let value3: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #22)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #22)", .tags(.codable, .codedAt, .codedBy, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -509,7 +509,7 @@ struct CodedAtHelperTests { let value2: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #23)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtHelperTests #23)", .tags(.codable, .codedAt, .codedBy, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -585,7 +585,7 @@ struct CodedAtHelperTests { let value2: [String]? } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtHelperTests #4)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtHelperTests #4)", .tags(.classes, .codable, .codedAt, .codedBy, .decoding, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift b/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift index f1b5a62ace..40c964859d 100644 --- a/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift +++ b/Tests/MetaCodableTests/CodedAt/CodedAtTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Coded At Tests") struct CodedAtTests { - @Test("Reports error for @CodedAt misuse") + @Test("Reports error for @CodedAt misuse", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -37,7 +37,7 @@ struct CodedAtTests { ) } - @Test("Reports error for @CodedAt misuse (CodedAtTests #1)") + @Test("Reports error for @CodedAt misuse (CodedAtTests #1)", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -58,7 +58,7 @@ struct CodedAtTests { ) } - @Test("Reports error for @CodedAt misuse (CodedAtTests #2)") + @Test("Reports error for @CodedAt misuse (CodedAtTests #2)", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -87,7 +87,7 @@ struct CodedAtTests { ) } - @Test("Reports error for @CodedAt misuse (CodedAtTests #3)") + @Test("Reports error for @CodedAt misuse (CodedAtTests #3)", .tags(.codedAt, .codedIn, .errorHandling, .macroExpansion, .structs)) func misuseInCombinationWithCodedInMacro() throws { assertMacroExpansion( """ @@ -126,7 +126,7 @@ struct CodedAtTests { ) } - @Test("Reports error when @CodedAt is applied multiple times") + @Test("Reports error when @CodedAt is applied multiple times", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -174,7 +174,7 @@ struct CodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedAtTests #34)") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #34)", .tags(.codable, .codedAt, .encoding, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -220,7 +220,7 @@ struct CodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (CodedAtTests #35)") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #35)", .tags(.codable, .codedAt, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -265,7 +265,7 @@ struct CodedAtTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (CodedAtTests #36)") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #36)", .tags(.codable, .codedAt, .encoding, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -312,7 +312,7 @@ struct CodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedAtTests #37)") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #37)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -356,7 +356,7 @@ struct CodedAtTests { ) } - @Test("Encodes and decodes successfully (CodedAtTests #9)") + @Test("Encodes and decodes successfully (CodedAtTests #9)", .tags(.decoding, .encoding)) func decodingAndEncoding() throws { let original = SomeCodable(value: "test") let encoded = try JSONEncoder().encode(original) @@ -365,7 +365,7 @@ struct CodedAtTests { #expect(decoded.value == "test") } - @Test("Decodes from JSON successfully (CodedAtTests #28)") + @Test("Decodes from JSON successfully (CodedAtTests #28)", .tags(.decoding)) func decodingFromJSON() throws { let jsonStr = """ { @@ -378,7 +378,7 @@ struct CodedAtTests { #expect(decoded.value == "custom_value") } - @Test("Encodes to JSON successfully (CodedAtTests #5)") + @Test("Encodes to JSON successfully (CodedAtTests #5)", .tags(.encoding, .optionals)) func encodingToJSON() throws { let original = SomeCodable(value: "encoded_value") let encoded = try JSONEncoder().encode(original) @@ -398,7 +398,7 @@ struct CodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (CodedAtTests #38)") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #38)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -442,7 +442,7 @@ struct CodedAtTests { ) } - @Test("Encodes and decodes successfully (CodedAtTests #10)") + @Test("Encodes and decodes successfully (CodedAtTests #10)", .tags(.decoding, .encoding)) func decodingAndEncodingWithValue() throws { let original = SomeCodable(value: "optional_test") let encoded = try JSONEncoder().encode(original) @@ -451,7 +451,7 @@ struct CodedAtTests { #expect(decoded.value == "optional_test") } - @Test("Encodes and decodes successfully (CodedAtTests #11)") + @Test("Encodes and decodes successfully (CodedAtTests #11)", .tags(.decoding, .encoding)) func decodingAndEncodingWithNil() throws { let original = SomeCodable(value: nil) let encoded = try JSONEncoder().encode(original) @@ -460,7 +460,7 @@ struct CodedAtTests { #expect(decoded.value == nil) } - @Test("Decodes from JSON successfully (CodedAtTests #29)") + @Test("Decodes from JSON successfully (CodedAtTests #29)", .tags(.decoding)) func decodingFromJSONWithMissingKey() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -478,7 +478,7 @@ struct CodedAtTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (CodedAtTests #39)") + @Test("Generates macro expansion with @Codable for struct (CodedAtTests #39)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -533,7 +533,7 @@ struct CodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #24)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #24)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -593,7 +593,7 @@ struct CodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #25)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #25)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -660,7 +660,7 @@ struct CodedAtTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #26)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #26)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -735,7 +735,7 @@ struct CodedAtTests { let value4: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #27)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #27)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -832,7 +832,7 @@ struct CodedAtTests { let value3: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #28)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedAtTests #28)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -909,7 +909,7 @@ struct CodedAtTests { let value3: String! } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtTests #5)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedAtTests #5)", .tags(.classes, .codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ @@ -982,7 +982,7 @@ struct CodedAtTests { } #endif - @Test("Generates macro expansion with @Codable for enum with nested paths") + @Test("Generates macro expansion with @Codable for enum with nested paths", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .optionals)) func expansion() throws { #if swift(>=6) let decodablePrefix = "@preconcurrency " diff --git a/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift b/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift index 49b8b07fe9..983395c152 100644 --- a/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift +++ b/Tests/MetaCodableTests/CodedAt/DecodedAtTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Decoded At Tests") struct DecodedAtTests { - @Test("Reports error for @DecodedAt misuse") + @Test("Reports error for @DecodedAt misuse", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -36,7 +36,7 @@ struct DecodedAtTests { ) } - @Test("Reports error for @DecodedAt misuse (DecodedAtTests #1)") + @Test("Reports error for @DecodedAt misuse (DecodedAtTests #1)", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct DecodedAtTests { ) } - @Test("Reports error for @DecodedAt misuse (DecodedAtTests #2)") + @Test("Reports error for @DecodedAt misuse (DecodedAtTests #2)", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -86,7 +86,7 @@ struct DecodedAtTests { ) } - @Test("Reports error for @CodedIn misuse") + @Test("Reports error for @CodedIn misuse", .tags(.codedAt, .codedIn, .errorHandling, .macroExpansion, .structs)) func misuseInCombinationWithCodedInMacro() throws { assertMacroExpansion( """ @@ -125,7 +125,7 @@ struct DecodedAtTests { ) } - @Test("Reports error for @CodedAt misuse (DecodedAtTests #4)") + @Test("Reports error for @CodedAt misuse (DecodedAtTests #4)", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseInCombinationWithCodedAtMacro() throws { assertMacroExpansion( """ @@ -164,7 +164,7 @@ struct DecodedAtTests { ) } - @Test("Reports error when @DecodedAt is applied multiple times") + @Test("Reports error when @DecodedAt is applied multiple times", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -212,7 +212,7 @@ struct DecodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #40)") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #40)", .tags(.codable, .codedAt, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -265,7 +265,7 @@ struct DecodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #41)") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #41)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -317,7 +317,7 @@ struct DecodedAtTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #42)") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #42)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -371,7 +371,7 @@ struct DecodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #43)") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #43)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -426,7 +426,7 @@ struct DecodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #44)") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #44)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -480,7 +480,7 @@ struct DecodedAtTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #45)") + @Test("Generates macro expansion with @Codable for struct (DecodedAtTests #45)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -536,7 +536,7 @@ struct DecodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #29)") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #29)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -595,7 +595,7 @@ struct DecodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #30)") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #30)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -663,7 +663,7 @@ struct DecodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #31)") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #31)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -723,7 +723,7 @@ struct DecodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #32)") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtTests #32)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift b/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift index ebd8b1f3fd..31c96054c4 100644 --- a/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift +++ b/Tests/MetaCodableTests/CodedAt/EncodedAtTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Encoded At Tests") struct EncodedAtTests { - @Test("Reports error for @EncodedAt misuse") + @Test("Reports error for @EncodedAt misuse", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -36,7 +36,7 @@ struct EncodedAtTests { ) } - @Test("Reports error for @EncodedAt misuse (EncodedAtTests #1)") + @Test("Reports error for @EncodedAt misuse (EncodedAtTests #1)", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseOnGroupedVariableDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct EncodedAtTests { ) } - @Test("Reports error for @EncodedAt misuse (EncodedAtTests #2)") + @Test("Reports error for @EncodedAt misuse (EncodedAtTests #2)", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -86,7 +86,7 @@ struct EncodedAtTests { ) } - @Test("Reports error for @CodedIn misuse (EncodedAtTests #1)") + @Test("Reports error for @CodedIn misuse (EncodedAtTests #1)", .tags(.codedAt, .codedIn, .errorHandling, .macroExpansion, .structs)) func misuseInCombinationWithCodedInMacro() throws { assertMacroExpansion( """ @@ -125,7 +125,7 @@ struct EncodedAtTests { ) } - @Test("Reports error for @CodedAt misuse (EncodedAtTests #5)") + @Test("Reports error for @CodedAt misuse (EncodedAtTests #5)", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func misuseInCombinationWithCodedAtMacro() throws { assertMacroExpansion( """ @@ -164,7 +164,7 @@ struct EncodedAtTests { ) } - @Test("Reports error when @EncodedAt is applied multiple times") + @Test("Reports error when @EncodedAt is applied multiple times", .tags(.codedAt, .errorHandling, .macroExpansion, .structs)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -212,7 +212,7 @@ struct EncodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #46)") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #46)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -265,7 +265,7 @@ struct EncodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #47)") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #47)", .tags(.codable, .codedAt, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -317,7 +317,7 @@ struct EncodedAtTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #48)") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #48)", .tags(.codable, .codedAt, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -371,7 +371,7 @@ struct EncodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #49)") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #49)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -426,7 +426,7 @@ struct EncodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #50)") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #50)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -480,7 +480,7 @@ struct EncodedAtTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #51)") + @Test("Generates macro expansion with @Codable for struct (EncodedAtTests #51)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -536,7 +536,7 @@ struct EncodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #33)") + @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #33)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -595,7 +595,7 @@ struct EncodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #34)") + @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #34)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -655,7 +655,7 @@ struct EncodedAtTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #35)") + @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #35)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -715,7 +715,7 @@ struct EncodedAtTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #36)") + @Test("Generates macro expansion with @Codable for struct with nested paths (EncodedAtTests #36)", .tags(.codable, .codedAt, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift b/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift index 39ac2aebcb..cd86ab9f67 100644 --- a/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift +++ b/Tests/MetaCodableTests/CodedBy/CodedByActionTests.swift @@ -44,7 +44,7 @@ struct CodedByActionTests { } } - @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #52)") + @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #52)", .tags(.codable, .codedBy, .decoding, .default, .encoding, .enums, .helperCoders, .macroExpansion, .optionals, .structs)) func expansion() { assertMacroExpansion( """ @@ -170,7 +170,7 @@ struct CodedByActionTests { ) } - @Test("Encodes and decodes successfully (CodedByActionTests #12)") + @Test("Encodes and decodes successfully (CodedByActionTests #12)", .tags(.codedBy, .decoding, .encoding)) func customCoderVersionBehavior() throws { // Test version 1 behavior let dog1 = Dog(name: "Buddy", version: 1, info: Dog.Info(tag: 5)) @@ -189,7 +189,7 @@ struct CodedByActionTests { #expect(decoded2.info.tag == 5) // Should be 5 after encode(-1) then decode(+1) } - @Test("Decodes from JSON successfully (CodedByActionTests #30)") + @Test("Decodes from JSON successfully (CodedByActionTests #30)", .tags(.codedBy, .decoding)) func customCoderFromJSON() throws { let jsonStr = """ { @@ -245,7 +245,7 @@ struct CodedByActionTests { } } - @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #53)") + @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #53)", .tags(.codable, .codedBy, .decoding, .default, .encoding, .enums, .helperCoders, .macroExpansion, .optionals, .structs)) func expansion() { assertMacroExpansion( """ @@ -427,7 +427,7 @@ struct CodedByActionTests { } } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedByActionTests #37)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedByActionTests #37)", .tags(.codable, .codedAt, .codedBy, .decoding, .encoding, .enums, .helperCoders, .ignoreCoding, .macroExpansion, .structs)) func expansion() { assertMacroExpansion( """ @@ -609,7 +609,7 @@ struct CodedByActionTests { } } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedByActionTests #38)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedByActionTests #38)", .tags(.codable, .codedAt, .codedBy, .decoding, .encoding, .enums, .helperCoders, .ignoreCoding, .macroExpansion, .structs)) func expansion() { assertMacroExpansion( """ @@ -808,7 +808,7 @@ struct CodedByActionTests { } } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedByActionTests #39)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedByActionTests #39)", .tags(.codable, .codedAt, .codedBy, .codedIn, .decoding, .default, .encoding, .enums, .helperCoders, .macroExpansion, .optionals, .structs)) func expansion() { assertMacroExpansion( """ @@ -1032,7 +1032,7 @@ struct CodedByActionTests { } #endif - @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #54)") + @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #54)", .tags(.codable, .codedBy, .decoding, .encoding, .enums, .helperCoders, .ignoreCoding, .macroExpansion, .structs)) func expansion() { assertMacroExpansion( """ @@ -1204,7 +1204,7 @@ struct CodedByActionTests { } #endif - @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #55)") + @Test("Generates macro expansion with @Codable for struct (CodedByActionTests #55)", .tags(.codable, .codedBy, .decoding, .encoding, .enums, .helperCoders, .ignoreCoding, .macroExpansion, .structs)) func expansion() { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift index ee650a7d04..1e0be61f28 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInDefaultTests.swift @@ -14,7 +14,7 @@ struct CodedInDefaultTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedInDefaultTests #56)") + @Test("Generates macro expansion with @Codable for struct (CodedInDefaultTests #56)", .tags(.codable, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -77,7 +77,7 @@ struct CodedInDefaultTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (CodedInDefaultTests #57)") + @Test("Generates macro expansion with @Codable for struct (CodedInDefaultTests #57)", .tags(.codable, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -191,7 +191,7 @@ struct CodedInDefaultTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #40)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #40)", .tags(.codable, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -272,7 +272,7 @@ struct CodedInDefaultTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #41)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #41)", .tags(.codable, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -352,7 +352,7 @@ struct CodedInDefaultTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #42)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #42)", .tags(.codable, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -434,7 +434,7 @@ struct CodedInDefaultTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #43)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #43)", .tags(.codable, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -532,7 +532,7 @@ struct CodedInDefaultTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #44)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #44)", .tags(.codable, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -629,7 +629,7 @@ struct CodedInDefaultTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #45)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #45)", .tags(.codable, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -733,7 +733,7 @@ struct CodedInDefaultTests { let value3: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #46)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #46)", .tags(.codable, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -852,7 +852,7 @@ struct CodedInDefaultTests { let value6: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #47)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInDefaultTests #47)", .tags(.codable, .codedAt, .codedIn, .decoding, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -1018,7 +1018,7 @@ struct CodedInDefaultTests { let value6: String } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedInDefaultTests #6)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInDefaultTests #6)", .tags(.classes, .codable, .codedAt, .codedIn, .decoding, .default, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift index 7b73582827..2298447a98 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultChoiceTests.swift @@ -18,7 +18,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultChoiceTests #58)") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultChoiceTests #58)", .tags(.codable, .codedBy, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -85,7 +85,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultChoiceTests #59)") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultChoiceTests #59)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -153,7 +153,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #48)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #48)", .tags(.codable, .codedBy, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -238,7 +238,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #49)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #49)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -323,7 +323,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #50)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #50)", .tags(.codable, .codedBy, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -425,7 +425,7 @@ struct CodedInHelperDefaultChoiceTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #51)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #51)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -543,7 +543,7 @@ struct CodedInHelperDefaultChoiceTests { let value5: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #52)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #52)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -699,7 +699,7 @@ struct CodedInHelperDefaultChoiceTests { let value6: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #53)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultChoiceTests #53)", .tags(.codable, .codedBy, .codedIn, .decoding, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -857,7 +857,7 @@ struct CodedInHelperDefaultChoiceTests { let value6: [String] } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperDefaultChoiceTests #7)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperDefaultChoiceTests #7)", .tags(.classes, .codable, .codedBy, .codedIn, .decoding, .default, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift index 066ab14b2d..e002496495 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultOnlyMissingTests.swift @@ -18,7 +18,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultOnlyMissingTests #60)") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultOnlyMissingTests #60)", .tags(.codable, .codedBy, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -77,7 +77,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultOnlyMissingTests #61)") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultOnlyMissingTests #61)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -137,7 +137,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #54)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #54)", .tags(.codable, .codedBy, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -204,7 +204,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #55)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #55)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -271,7 +271,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #56)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #56)", .tags(.codable, .codedBy, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -345,7 +345,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #57)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #57)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -435,7 +435,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value5: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #58)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #58)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -567,7 +567,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value6: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #59)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultOnlyMissingTests #59)", .tags(.codable, .codedBy, .codedIn, .decoding, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -706,7 +706,7 @@ struct CodedInHelperDefaultOnlyMissingTests { let value6: [String] } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperDefaultOnlyMissingTests #8)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperDefaultOnlyMissingTests #8)", .tags(.classes, .codable, .codedBy, .codedIn, .decoding, .default, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift index 71ef312b18..1900422673 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperDefaultTests.swift @@ -18,7 +18,7 @@ struct CodedInHelperDefaultTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultTests #62)") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultTests #62)", .tags(.codable, .codedBy, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -85,7 +85,7 @@ struct CodedInHelperDefaultTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultTests #63)") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperDefaultTests #63)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -153,7 +153,7 @@ struct CodedInHelperDefaultTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #60)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #60)", .tags(.codable, .codedBy, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -238,7 +238,7 @@ struct CodedInHelperDefaultTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #61)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #61)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -323,7 +323,7 @@ struct CodedInHelperDefaultTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #62)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #62)", .tags(.codable, .codedBy, .codedIn, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -425,7 +425,7 @@ struct CodedInHelperDefaultTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #63)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #63)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -543,7 +543,7 @@ struct CodedInHelperDefaultTests { let value5: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #64)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #64)", .tags(.codable, .codedBy, .codedIn, .default, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -699,7 +699,7 @@ struct CodedInHelperDefaultTests { let value6: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #65)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperDefaultTests #65)", .tags(.codable, .codedBy, .codedIn, .decoding, .default, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -857,7 +857,7 @@ struct CodedInHelperDefaultTests { let value6: [String] } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperDefaultTests #9)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperDefaultTests #9)", .tags(.classes, .codable, .codedBy, .codedIn, .decoding, .default, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift index 44db335db8..2d984b20d3 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInHelperTests.swift @@ -17,7 +17,7 @@ struct CodedInHelperTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct (CodedInHelperTests #64)") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperTests #64)", .tags(.codable, .codedBy, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -74,7 +74,7 @@ struct CodedInHelperTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct (CodedInHelperTests #65)") + @Test("Generates macro expansion with @Codable for struct (CodedInHelperTests #65)", .tags(.codable, .codedBy, .codedIn, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -132,7 +132,7 @@ struct CodedInHelperTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #66)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #66)", .tags(.codable, .codedBy, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -193,7 +193,7 @@ struct CodedInHelperTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #67)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #67)", .tags(.codable, .codedBy, .codedIn, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -258,7 +258,7 @@ struct CodedInHelperTests { let value: [String] } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #68)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #68)", .tags(.codable, .codedBy, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -322,7 +322,7 @@ struct CodedInHelperTests { let value: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #69)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #69)", .tags(.codable, .codedBy, .codedIn, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -404,7 +404,7 @@ struct CodedInHelperTests { let value3: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #70)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #70)", .tags(.codable, .codedBy, .codedIn, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -500,7 +500,7 @@ struct CodedInHelperTests { let value2: [String]? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #71)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInHelperTests #71)", .tags(.codable, .codedBy, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -576,7 +576,7 @@ struct CodedInHelperTests { let value2: [String]? } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperTests #10)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInHelperTests #10)", .tags(.classes, .codable, .codedBy, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodedIn/CodedInTests.swift b/Tests/MetaCodableTests/CodedIn/CodedInTests.swift index d414d091f4..febaae4b78 100644 --- a/Tests/MetaCodableTests/CodedIn/CodedInTests.swift +++ b/Tests/MetaCodableTests/CodedIn/CodedInTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Coded In Tests") struct CodedInTests { - @Test("Reports error for @CodedIn misuse (CodedInTests #2)") + @Test("Reports error for @CodedIn misuse (CodedInTests #2)", .tags(.codedIn, .errorHandling, .macroExpansion, .structs)) func misuseOnNonVariableDeclaration() throws { assertMacroExpansion( """ @@ -37,7 +37,7 @@ struct CodedInTests { ) } - @Test("Reports error for @CodedIn misuse (CodedInTests #3)") + @Test("Reports error for @CodedIn misuse (CodedInTests #3)", .tags(.codedIn, .errorHandling, .macroExpansion, .structs)) func misuseOnStaticVariableDeclaration() throws { assertMacroExpansion( """ @@ -66,7 +66,7 @@ struct CodedInTests { ) } - @Test("Reports error when @CodedIn is applied multiple times") + @Test("Reports error when @CodedIn is applied multiple times", .tags(.codedIn, .errorHandling, .macroExpansion, .structs)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -114,7 +114,7 @@ struct CodedInTests { let value: String } - @Test("Generates macro expansion with @Codable for struct (CodedInTests #66)") + @Test("Generates macro expansion with @Codable for struct (CodedInTests #66)", .tags(.codable, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -168,7 +168,7 @@ struct CodedInTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (CodedInTests #67)") + @Test("Generates macro expansion with @Codable for struct (CodedInTests #67)", .tags(.codable, .codedIn, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -263,7 +263,7 @@ struct CodedInTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #72)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #72)", .tags(.codable, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -320,7 +320,7 @@ struct CodedInTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #73)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #73)", .tags(.codable, .codedIn, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -429,7 +429,7 @@ struct CodedInTests { let value: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #74)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #74)", .tags(.codable, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -479,7 +479,7 @@ struct CodedInTests { ) } - @Test("Encodes and decodes successfully (CodedInTests #13)") + @Test("Encodes and decodes successfully (CodedInTests #13)", .tags(.codedIn, .decoding, .encoding)) func decodingAndEncoding() throws { let original = SomeCodable(value: "nested_test") let encoded = try JSONEncoder().encode(original) @@ -488,7 +488,7 @@ struct CodedInTests { #expect(decoded.value == "nested_test") } - @Test("Decodes from JSON successfully (CodedInTests #31)") + @Test("Decodes from JSON successfully (CodedInTests #31)", .tags(.codedIn, .decoding)) func decodingFromNestedJSON() throws { let jsonStr = """ { @@ -505,7 +505,7 @@ struct CodedInTests { #expect(decoded.value == "deep_value") } - @Test("Encodes to JSON successfully (CodedInTests #6)") + @Test("Encodes to JSON successfully (CodedInTests #6)", .tags(.codedIn, .encoding, .optionals)) func encodingToNestedJSON() throws { let original = SomeCodable(value: "encoded_nested") let encoded = try JSONEncoder().encode(original) @@ -527,7 +527,7 @@ struct CodedInTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #75)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #75)", .tags(.codable, .codedIn, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -594,7 +594,7 @@ struct CodedInTests { let value: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #76)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #76)", .tags(.codable, .codedIn, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -667,7 +667,7 @@ struct CodedInTests { let value3: String? } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #77)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #77)", .tags(.codable, .codedIn, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -768,7 +768,7 @@ struct CodedInTests { let value3: String! } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #78)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodedInTests #78)", .tags(.codable, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -859,7 +859,7 @@ struct CodedInTests { let value3: String! } - @Test("Generates macro expansion with @Codable for class with nested paths (CodedInTests #11)") + @Test("Generates macro expansion with @Codable for class with nested paths (CodedInTests #11)", .tags(.classes, .codable, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ @@ -946,7 +946,7 @@ struct CodedInTests { } #endif - @Test("Generates macro expansion with @Codable for enum with nested paths (CodedInTests #1)") + @Test("Generates macro expansion with @Codable for enum with nested paths (CodedInTests #1)", .tags(.codable, .codedIn, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .optionals)) func expansion() throws { #if swift(>=6) let decodablePrefix = "@preconcurrency " diff --git a/Tests/MetaCodableTests/CodingKeysGenerationTests.swift b/Tests/MetaCodableTests/CodingKeysGenerationTests.swift index 63c0cbfc51..ba9ae44367 100644 --- a/Tests/MetaCodableTests/CodingKeysGenerationTests.swift +++ b/Tests/MetaCodableTests/CodingKeysGenerationTests.swift @@ -13,7 +13,7 @@ struct CodingKeysGenerationTests { let `internal`: String } - @Test("Generates @Codable conformance for struct (CodingKeysGenerationTests #6)") + @Test("Generates @Codable conformance for struct (CodingKeysGenerationTests #6)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -51,7 +51,7 @@ struct CodingKeysGenerationTests { ) } - @Test("Encodes and decodes successfully (CodingKeysGenerationTests #14)") + @Test("Encodes and decodes successfully (CodingKeysGenerationTests #14)", .tags(.codingKeys, .decoding, .encoding)) func decodingAndEncoding() throws { let original = SomeCodable(internal: "reserved") let encoded = try JSONEncoder().encode(original) @@ -60,7 +60,7 @@ struct CodingKeysGenerationTests { #expect(decoded.internal == "reserved") } - @Test("Decodes from JSON successfully (CodingKeysGenerationTests #32)") + @Test("Decodes from JSON successfully (CodingKeysGenerationTests #32)", .tags(.codingKeys, .decoding)) func decodingFromJSON() throws { let jsonStr = """ { @@ -84,7 +84,7 @@ struct CodingKeysGenerationTests { let val2: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodingKeysGenerationTests #79)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodingKeysGenerationTests #79)", .tags(.codable, .codedIn, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -135,7 +135,7 @@ struct CodingKeysGenerationTests { ) } - @Test("Encodes and decodes successfully (CodingKeysGenerationTests #15)") + @Test("Encodes and decodes successfully (CodingKeysGenerationTests #15)", .tags(.codingKeys, .decoding, .encoding)) func decodingAndEncoding() throws { let original = SomeCodable(val1: "first", val2: "second") let encoded = try JSONEncoder().encode(original) @@ -145,7 +145,7 @@ struct CodingKeysGenerationTests { #expect(decoded.val2 == "second") } - @Test("Decodes from JSON successfully (CodingKeysGenerationTests #33)") + @Test("Decodes from JSON successfully (CodingKeysGenerationTests #33)", .tags(.codingKeys, .decoding)) func decodingFromJSON() throws { let jsonStr = """ { @@ -173,7 +173,7 @@ struct CodingKeysGenerationTests { let val: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodingKeysGenerationTests #80)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodingKeysGenerationTests #80)", .tags(.codable, .codedAt, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -228,7 +228,7 @@ struct CodingKeysGenerationTests { let val3: String } - @Test("Generates macro expansion with @Codable for struct with nested paths (CodingKeysGenerationTests #81)") + @Test("Generates macro expansion with @Codable for struct with nested paths (CodingKeysGenerationTests #81)", .tags(.codable, .codedIn, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/CodingKeysTests.swift b/Tests/MetaCodableTests/CodingKeysTests.swift index 05f6884e7b..3c172b14a5 100644 --- a/Tests/MetaCodableTests/CodingKeysTests.swift +++ b/Tests/MetaCodableTests/CodingKeysTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Coding Keys Tests") struct CodingKeysTests { - @Test("Reports error when @CodingKeys is used without @Codable") + @Test("Reports error when @CodingKeys is used without @Codable", .tags(.codable, .codingKeys, .errorHandling, .macroExpansion, .structs)) func misuseInAbsenceOfCodable() throws { assertMacroExpansion( """ @@ -40,7 +40,7 @@ struct CodingKeysTests { ) } - @Test("Reports error when @Codable is applied multiple times (CodingKeysTests #1)") + @Test("Reports error when @Codable is applied multiple times (CodingKeysTests #1)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .errorHandling, .macroExpansion, .structs)) func misuseOnDuplicationAbsenceOfCodable() throws { assertMacroExpansion( """ @@ -124,7 +124,7 @@ struct CodingKeysTests { let description: String } - @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #68)") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #68)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -184,7 +184,7 @@ struct CodingKeysTests { let description: String } - @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #69)") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #69)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -244,7 +244,7 @@ struct CodingKeysTests { let description: String } - @Test("Generates macro expansion with @Codable for class (CodingKeysTests #3)") + @Test("Generates macro expansion with @Codable for class (CodingKeysTests #3)", .tags(.classes, .codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -308,7 +308,7 @@ struct CodingKeysTests { case multi(_ variable: Bool, val: Int, String) } - @Test("Generates macro expansion with @Codable for enum (CodingKeysTests #8)") + @Test("Generates macro expansion with @Codable for enum (CodingKeysTests #8)", .tags(.codable, .codedAs, .codingKeys, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -430,7 +430,7 @@ struct CodingKeysTests { let description: String } - @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #70)") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #70)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -490,7 +490,7 @@ struct CodingKeysTests { let description: String } - @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #71)") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #71)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -550,7 +550,7 @@ struct CodingKeysTests { let description: String } - @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #72)") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #72)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -610,7 +610,7 @@ struct CodingKeysTests { let description: String } - @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #73)") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #73)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -670,7 +670,7 @@ struct CodingKeysTests { let description: String } - @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #74)") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #74)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -730,7 +730,7 @@ struct CodingKeysTests { let description: String } - @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #75)") + @Test("Generates macro expansion with @Codable for struct (CodingKeysTests #75)", .tags(.codable, .codingKeys, .decoding, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -795,7 +795,7 @@ struct CodingKeysTests { case multi(_ variable: Bool, val: Int, String) } - @Test("Generates macro expansion with @Codable for enum (CodingKeysTests #9)") + @Test("Generates macro expansion with @Codable for enum (CodingKeysTests #9)", .tags(.codable, .codedAs, .codingKeys, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/ConditionalCoderTests.swift b/Tests/MetaCodableTests/ConditionalCoderTests.swift index b16407f321..2efe7a7083 100644 --- a/Tests/MetaCodableTests/ConditionalCoderTests.swift +++ b/Tests/MetaCodableTests/ConditionalCoderTests.swift @@ -79,7 +79,7 @@ struct ConditionalCoderTests { // MARK: - decodeIfPresent Tests /// Tests that `decodeIfPresent` uses the decoder coder and returns value. - @Test("Decodes from JSON successfully (ConditionalCoderTests #34)") + @Test("Decodes from JSON successfully (ConditionalCoderTests #34)", .tags(.conditionalCoder, .decoding)) func decodeIfPresentReturnsValue() throws { let json = #"{"value": "test"}"# let data = json.data(using: .utf8)! @@ -89,7 +89,7 @@ struct ConditionalCoderTests { } /// Tests that `decodeIfPresent` returns nil when value is null. - @Test("Decodes from JSON successfully (ConditionalCoderTests #35)") + @Test("Decodes from JSON successfully (ConditionalCoderTests #35)", .tags(.conditionalCoder, .decoding)) func decodeIfPresentReturnsNilForNull() throws { let json = #"{"value": null}"# let data = json.data(using: .utf8)! @@ -99,7 +99,7 @@ struct ConditionalCoderTests { } /// Tests that `decodeIfPresent` returns nil when key is missing. - @Test("Decodes from JSON successfully (ConditionalCoderTests #36)") + @Test("Decodes from JSON successfully (ConditionalCoderTests #36)", .tags(.conditionalCoder, .decoding)) func decodeIfPresentReturnsNilForMissingKey() throws { let json = #"{}"# let data = json.data(using: .utf8)! @@ -111,7 +111,7 @@ struct ConditionalCoderTests { // MARK: - encodeIfPresent Tests /// Tests that `encodeIfPresent` uses the encoder coder when value is present. - @Test("Encodes to JSON successfully (ConditionalCoderTests #7)") + @Test("Encodes to JSON successfully (ConditionalCoderTests #7)", .tags(.conditionalCoder, .encoding)) func encodeIfPresentEncodesValue() throws { let wrapper = EncodingWrapper(value: "test") let data = try JSONEncoder().encode(wrapper) @@ -121,7 +121,7 @@ struct ConditionalCoderTests { } /// Tests that `encodeIfPresent` skips encoding when value is nil. - @Test("Encodes to JSON successfully (ConditionalCoderTests #8)") + @Test("Encodes to JSON successfully (ConditionalCoderTests #8)", .tags(.conditionalCoder, .encoding)) func encodeIfPresentSkipsNil() throws { let wrapper = EncodingWrapper(value: nil) let data = try JSONEncoder().encode(wrapper) diff --git a/Tests/MetaCodableTests/ConformCodableTests.swift b/Tests/MetaCodableTests/ConformCodableTests.swift index 9d1dabd25a..df57581e08 100644 --- a/Tests/MetaCodableTests/ConformCodableTests.swift +++ b/Tests/MetaCodableTests/ConformCodableTests.swift @@ -11,7 +11,7 @@ import Testing @Suite("Conform Encodable Tests") struct ConformEncodableTests { - @Test("Reports error for @Codable misuse (ConformCodableTests #4)") + @Test("Reports error for @Codable misuse (ConformCodableTests #4)", .tags(.codable, .errorHandling, .macroExpansion, .structs)) func misuseWithCodable() throws { assertMacroExpansion( """ @@ -52,7 +52,7 @@ struct ConformEncodableTests { ) } - @Test("Reports diagnostic error") + @Test("Reports diagnostic error", .tags(.errorHandling, .macroExpansion, .structs)) func misuseWithDecodable() throws { assertMacroExpansion( """ @@ -101,7 +101,7 @@ struct ConformEncodableTests { let count: Int } - @Test("Generates macro expansion for struct") + @Test("Generates macro expansion for struct", .tags(.encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -147,7 +147,7 @@ struct ConformEncodableTests { let string: String } - @Test("Encodes to JSON successfully (ConformCodableTests #9)") + @Test("Encodes to JSON successfully (ConformCodableTests #9)", .tags(.encoding, .optionals)) func testParsing() throws { let model = Model( bool: true, int: 42, double: 3.1416, string: "5265762156") @@ -169,7 +169,7 @@ struct ConformEncodableTests { #expect(reDecoded["string"] as? String == "5265762156") } - @Test("Generates macro expansion for struct (ConformCodableTests #1)") + @Test("Generates macro expansion for struct (ConformCodableTests #1)", .tags(.encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -224,7 +224,7 @@ struct ConformEncodableTests { let count: Int } - @Test("Generates macro expansion with @CodedAt for struct with nested paths") + @Test("Generates macro expansion with @CodedAt for struct with nested paths", .tags(.codedAt, .codedIn, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -277,7 +277,7 @@ struct ConformDecodableTests { let count: Int } - @Test("Generates macro expansion for struct (ConformCodableTests #2)") + @Test("Generates macro expansion for struct (ConformCodableTests #2)", .tags(.decoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -312,7 +312,7 @@ struct ConformDecodableTests { ) } - @Test("Decodes from JSON successfully (ConformCodableTests #37)") + @Test("Decodes from JSON successfully (ConformCodableTests #37)", .tags(.decoding)) func decodingOnly() throws { // Since SomeDecodable only conforms to Decodable, we can only test decoding let jsonStr = """ @@ -328,7 +328,7 @@ struct ConformDecodableTests { #expect(decoded.count == 42) } - @Test("Decodes from JSON successfully (ConformCodableTests #38)") + @Test("Decodes from JSON successfully (ConformCodableTests #38)", .tags(.decoding)) func decodingFromJSON() throws { let jsonStr = """ { @@ -354,7 +354,7 @@ struct ConformDecodableTests { let string: String } - @Test("Decodes from JSON successfully (ConformCodableTests #39)") + @Test("Decodes from JSON successfully (ConformCodableTests #39)", .tags(.decoding)) func testParsing() throws { let json = """ { @@ -375,7 +375,7 @@ struct ConformDecodableTests { #expect(model.string == "5265762156") } - @Test("Generates macro expansion for struct (ConformCodableTests #3)") + @Test("Generates macro expansion for struct (ConformCodableTests #3)", .tags(.decoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -430,7 +430,7 @@ struct ConformDecodableTests { let count: Int } - @Test("Generates macro expansion with @CodedAt for struct with nested paths (ConformCodableTests #1)") + @Test("Generates macro expansion with @CodedAt for struct with nested paths (ConformCodableTests #1)", .tags(.codedAt, .codedIn, .decoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/ContentAtTests.swift b/Tests/MetaCodableTests/ContentAtTests.swift index 085eed9570..64611cccf5 100644 --- a/Tests/MetaCodableTests/ContentAtTests.swift +++ b/Tests/MetaCodableTests/ContentAtTests.swift @@ -7,7 +7,7 @@ import Testing @Suite("Content At Tests") struct ContentAtTests { - @Test("Reports error when @ContentAt is used without @Codable") + @Test("Reports error when @ContentAt is used without @Codable", .tags(.codable, .codedAt, .contentAt, .enums, .errorHandling, .macroExpansion)) func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct ContentAtTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (ContentAtTests #10)") + @Test("Generates macro expansion with @Codable for enum (ContentAtTests #10)", .tags(.codable, .codedAt, .contentAt, .decoding, .encoding, .enums, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ @@ -147,7 +147,7 @@ struct ContentAtTests { ) } - @Test("Encodes to JSON successfully (ContentAtTests #10)") + @Test("Encodes to JSON successfully (ContentAtTests #10)", .tags(.contentAt, .encoding, .optionals)) func contentAtEncodingStructure() throws { let loadCommand: Command = .load(key: "test_key") let encoded = try JSONEncoder().encode(loadCommand) @@ -160,7 +160,7 @@ struct ContentAtTests { #expect(content["key"] as? String == "test_key") } - @Test("Decodes from JSON successfully (ContentAtTests #40)") + @Test("Decodes from JSON successfully (ContentAtTests #40)", .tags(.contentAt, .decoding)) func contentAtFromJSON() throws { // The decoding expects key/value at root level, not in content let jsonStr = """ @@ -181,7 +181,7 @@ struct ContentAtTests { } } - @Test("Encodes to JSON successfully (ContentAtTests #11)") + @Test("Encodes to JSON successfully (ContentAtTests #11)", .tags(.contentAt, .encoding, .optionals)) func contentAtJSONStructure() throws { let storeCommand: Command = .store(key: "test", value: 100) let encoded = try JSONEncoder().encode(storeCommand) @@ -209,7 +209,7 @@ struct ContentAtTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (ContentAtTests #11)") + @Test("Generates macro expansion with @Codable for enum (ContentAtTests #11)", .tags(.codable, .codedAs, .codedAt, .contentAt, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -311,7 +311,7 @@ struct ContentAtTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (ContentAtTests #12)") + @Test("Generates macro expansion with @Codable for enum (ContentAtTests #12)", .tags(.codable, .codedAs, .codedAt, .codedBy, .contentAt, .decoding, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift b/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift index 9aeaa23493..23bc036e08 100644 --- a/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift +++ b/Tests/MetaCodableTests/DecodedAtEncodedAtIntegrationTests.swift @@ -18,7 +18,7 @@ struct DecodedAtEncodedAtIntegrationTests { let age: Int } - @Test("Encodes and decodes with JSON successfully (DecodedAtEncodedAtIntegrationTests #6)") + @Test("Encodes and decodes with JSON successfully (DecodedAtEncodedAtIntegrationTests #6)", .tags(.codedAt, .decoding, .encoding, .integration, .optionals)) func differentPathsForDecodingAndEncoding() throws { // Sample JSON with nested structure for decoding let jsonData = """ @@ -67,7 +67,7 @@ struct DecodedAtEncodedAtIntegrationTests { let createdAt: String } - @Test("Encodes and decodes with JSON successfully (DecodedAtEncodedAtIntegrationTests #7)") + @Test("Encodes and decodes with JSON successfully (DecodedAtEncodedAtIntegrationTests #7)", .tags(.codedAt, .decoding, .encoding, .integration, .optionals)) func complexNestedStructure() throws { // Complex nested JSON for decoding let jsonData = """ @@ -119,7 +119,7 @@ struct DecodedAtEncodedAtIntegrationTests { let value: Int? } - @Test("Encodes and decodes with JSON successfully (DecodedAtEncodedAtIntegrationTests #8)") + @Test("Encodes and decodes with JSON successfully (DecodedAtEncodedAtIntegrationTests #8)", .tags(.codedAt, .decoding, .encoding, .integration, .optionals)) func optionalValues() throws { // JSON with all values present let fullJsonData = """ @@ -177,7 +177,7 @@ struct DecodedAtEncodedAtIntegrationTests { @Suite("Decoded At Encoded At Integration - Enum") struct EnumTests { - @Test("Reports error when @DecodedAt is used without @Codable") + @Test("Reports error when @DecodedAt is used without @Codable", .tags(.codable, .codedAt, .enums, .errorHandling, .integration, .macroExpansion)) func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -222,7 +222,7 @@ struct DecodedAtEncodedAtIntegrationTests { ) } - @Test("Reports error when @Codable is applied multiple times (DecodedAtEncodedAtIntegrationTests #2)") + @Test("Reports error when @Codable is applied multiple times (DecodedAtEncodedAtIntegrationTests #2)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .errorHandling, .integration, .macroExpansion)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -377,7 +377,7 @@ struct DecodedAtEncodedAtIntegrationTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (DecodedAtEncodedAtIntegrationTests #13)") + @Test("Generates macro expansion with @Codable for enum (DecodedAtEncodedAtIntegrationTests #13)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .integration, .macroExpansion, .optionals)) func expansion() throws { assertMacroExpansion( """ @@ -483,7 +483,7 @@ struct DecodedAtEncodedAtIntegrationTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (DecodedAtEncodedAtIntegrationTests #14)") + @Test("Generates macro expansion with @Codable for enum (DecodedAtEncodedAtIntegrationTests #14)", .tags(.codable, .codedAs, .codedAt, .decoding, .encoding, .enums, .integration, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -583,7 +583,7 @@ struct DecodedAtEncodedAtIntegrationTests { case store(key: String, value: Int) } - @Test("Generates macro expansion with @Codable for enum (DecodedAtEncodedAtIntegrationTests #15)") + @Test("Generates macro expansion with @Codable for enum (DecodedAtEncodedAtIntegrationTests #15)", .tags(.codable, .codedAs, .codedAt, .codedBy, .decoding, .encoding, .enums, .integration, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -701,7 +701,7 @@ struct DecodedAtEncodedAtIntegrationTests { } } - @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtEncodedAtIntegrationTests #82)") + @Test("Generates macro expansion with @Codable for struct with nested paths (DecodedAtEncodedAtIntegrationTests #82)", .tags(.codable, .codedAs, .codedAt, .codedIn, .decoding, .encoding, .enums, .integration, .macroExpansion, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift index 58d7381127..c83b508c00 100644 --- a/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift +++ b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift @@ -44,7 +44,7 @@ struct DefaultSequenceElementCodingTests { // MARK: - decodeIfPresent(from:) Tests /// Tests that `decodeIfPresent(from:)` returns value from single value container. - @Test("Decodes struct from JSON successfully") + @Test("Decodes struct from JSON successfully", .tags(.coverage, .decoding, .default, .optionals, .structs)) func decodeIfPresentFromDecoderReturnsValue() throws { let json = #""test""# let data = json.data(using: .utf8)! @@ -63,7 +63,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `decodeIfPresent(from:)` returns nil for null. - @Test("Decodes struct from JSON successfully (DefaultSequenceElementCodingTests #1)") + @Test("Decodes struct from JSON successfully (DefaultSequenceElementCodingTests #1)", .tags(.coverage, .decoding, .default, .optionals, .structs)) func decodeIfPresentFromDecoderReturnsNilForNull() throws { let json = #"null"# let data = json.data(using: .utf8)! @@ -84,7 +84,7 @@ struct DefaultSequenceElementCodingTests { // MARK: - decodeIfPresent(from:forKey:) Tests /// Tests that `decodeIfPresent(from:forKey:)` returns value when present. - @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #41)") + @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #41)", .tags(.coverage, .decoding, .default)) func decodeIfPresentFromKeyedContainerReturnsValue() throws { let json = #"{"value": "test"}"# let data = json.data(using: .utf8)! @@ -94,7 +94,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `decodeIfPresent(from:forKey:)` returns nil for null. - @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #42)") + @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #42)", .tags(.coverage, .decoding, .default)) func decodeIfPresentFromKeyedContainerReturnsNilForNull() throws { let json = #"{"value": null}"# let data = json.data(using: .utf8)! @@ -104,7 +104,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `decodeIfPresent(from:forKey:)` returns nil for missing key. - @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #43)") + @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #43)", .tags(.coverage, .decoding, .default)) func decodeIfPresentFromKeyedContainerReturnsNilForMissingKey() throws { let json = #"{}"# let data = json.data(using: .utf8)! @@ -116,7 +116,7 @@ struct DefaultSequenceElementCodingTests { // MARK: - encodeIfPresent(_:to:) Tests /// Tests that `encodeIfPresent(_:to:)` encodes value when present. - @Test("Encodes struct to JSON successfully") + @Test("Encodes struct to JSON successfully", .tags(.coverage, .default, .encoding, .optionals, .structs)) func encodeIfPresentToEncoderEncodesValue() throws { struct SingleValueWrapper: Encodable { let value: String? @@ -135,7 +135,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `encodeIfPresent(_:to:)` encodes null for nil. - @Test("Encodes struct to JSON successfully (DefaultSequenceElementCodingTests #1)") + @Test("Encodes struct to JSON successfully (DefaultSequenceElementCodingTests #1)", .tags(.coverage, .default, .encoding, .optionals, .structs)) func encodeIfPresentToEncoderEncodesNullForNil() throws { struct SingleValueWrapper: Encodable { let value: String? @@ -156,7 +156,7 @@ struct DefaultSequenceElementCodingTests { // MARK: - encodeIfPresent(_:to:atKey:) Tests /// Tests that `encodeIfPresent(_:to:atKey:)` encodes value when present. - @Test("Encodes to JSON successfully (DefaultSequenceElementCodingTests #12)") + @Test("Encodes to JSON successfully (DefaultSequenceElementCodingTests #12)", .tags(.coverage, .default, .encoding)) func encodeIfPresentToKeyedContainerEncodesValue() throws { let wrapper = EncodingWrapper(value: "test") let data = try JSONEncoder().encode(wrapper) @@ -166,7 +166,7 @@ struct DefaultSequenceElementCodingTests { } /// Tests that `encodeIfPresent(_:to:atKey:)` skips encoding for nil. - @Test("Encodes to JSON successfully (DefaultSequenceElementCodingTests #13)") + @Test("Encodes to JSON successfully (DefaultSequenceElementCodingTests #13)", .tags(.coverage, .default, .encoding)) func encodeIfPresentToKeyedContainerSkipsNil() throws { let wrapper = EncodingWrapper(value: nil) let data = try JSONEncoder().encode(wrapper) diff --git a/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift b/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift index 8ac768da8b..f9682c4fa3 100644 --- a/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift +++ b/Tests/MetaCodableTests/DynamicCodable/DynamicCodableTests.swift @@ -4,7 +4,7 @@ import Testing @Suite("Dynamic Codable Tests") struct DynamicCodableTests { - @Test("Decodes from JSON successfully (DynamicCodableTests #44)") + @Test("Decodes from JSON successfully (DynamicCodableTests #44)", .tags(.decoding, .dynamicCoding)) func pageWithExtPost() throws { let page = try JSONDecoder().decode( PageWithExtPosts.self, from: dataPageWithExtPosts @@ -27,7 +27,7 @@ struct DynamicCodableTests { } } - @Test("Decodes from JSON successfully (DynamicCodableTests #45)") + @Test("Decodes from JSON successfully (DynamicCodableTests #45)", .tags(.decoding, .dynamicCoding)) func pageWithIntPost() throws { let page = try JSONDecoder().decode( PageWithIntPosts.self, from: dataPageWithIntPosts @@ -50,7 +50,7 @@ struct DynamicCodableTests { } } - @Test("Decodes from JSON successfully (DynamicCodableTests #46)") + @Test("Decodes from JSON successfully (DynamicCodableTests #46)", .tags(.decoding, .dynamicCoding)) func pageWithAdjPost() throws { let page = try JSONDecoder().decode( PageWithAdjPosts.self, from: dataPageWithAdjPosts @@ -73,7 +73,7 @@ struct DynamicCodableTests { } } - @Test("Decodes from JSON successfully (DynamicCodableTests #47)") + @Test("Decodes from JSON successfully (DynamicCodableTests #47)", .tags(.decoding, .dynamicCoding)) func response() throws { let rResponse = try JSONDecoder().decode( Response.self, from: registrationResponseAttributesData diff --git a/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift index 1bcdbf5af9..0e5786d715 100644 --- a/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift +++ b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift @@ -15,7 +15,7 @@ struct DynamicCodableIdentifierTests { /// /// DynamicCodableIdentifier uses string-based keys only, /// so integer initialization is not supported. - @Test("Tests init int value returns nil") + @Test("Tests init int value returns nil", .tags(.coverage, .dynamicCoding)) func initIntValueReturnsNil() { let identifier = DynamicCodableIdentifier(intValue: 0) #expect(identifier == nil) @@ -28,7 +28,7 @@ struct DynamicCodableIdentifierTests { } /// Tests that `intValue` property always returns nil. - @Test("Tests int value property returns nil") + @Test("Tests int value property returns nil", .tags(.coverage, .dynamicCoding)) func intValuePropertyReturnsNil() { let identifier: DynamicCodableIdentifier = .one("test") #expect(identifier.intValue == nil) @@ -40,7 +40,7 @@ struct DynamicCodableIdentifierTests { // MARK: - init(stringValue:) Tests /// Tests that `init(stringValue:)` creates a single identifier. - @Test("Tests init string value creates single identifier") + @Test("Tests init string value creates single identifier", .tags(.coverage, .dynamicCoding, .optionals)) func initStringValueCreatesSingleIdentifier() { let identifier = DynamicCodableIdentifier(stringValue: "test") #expect(identifier != nil) @@ -50,21 +50,21 @@ struct DynamicCodableIdentifierTests { // MARK: - stringValue Tests /// Tests that `stringValue` returns the value for single identifier. - @Test("Tests string value returns single value") + @Test("Tests string value returns single value", .tags(.coverage, .dynamicCoding)) func stringValueReturnsSingleValue() { let identifier: DynamicCodableIdentifier = .one("myKey") #expect(identifier.stringValue == "myKey") } /// Tests that `stringValue` returns first value for multiple identifiers. - @Test("Tests string value returns first value") + @Test("Tests string value returns first value", .tags(.coverage, .dynamicCoding)) func stringValueReturnsFirstValue() { let identifier: DynamicCodableIdentifier = .many(["first", "second", "third"]) #expect(identifier.stringValue == "first") } /// Tests that `stringValue` returns empty string for empty multiple identifiers. - @Test("Tests string value returns empty for empty array") + @Test("Tests string value returns empty for empty array", .tags(.coverage, .dynamicCoding)) func stringValueReturnsEmptyForEmptyArray() { let identifier: DynamicCodableIdentifier = .many([]) #expect(identifier.stringValue == "") @@ -73,7 +73,7 @@ struct DynamicCodableIdentifierTests { // MARK: - Pattern Matching Tests /// Tests pattern matching with single identifier. - @Test("Tests pattern matching single identifier") + @Test("Tests pattern matching single identifier", .tags(.coverage, .dynamicCoding, .optionals, .structs)) func patternMatchingSingleIdentifier() { let identifier: DynamicCodableIdentifier = .one("type") @@ -92,7 +92,7 @@ struct DynamicCodableIdentifierTests { } /// Tests pattern matching with multiple identifiers. - @Test("Tests pattern matching multiple identifiers") + @Test("Tests pattern matching multiple identifiers", .tags(.coverage, .dynamicCoding, .optionals, .structs)) func patternMatchingMultipleIdentifiers() { let identifier: DynamicCodableIdentifier = .many(["type", "kind", "category"]) diff --git a/Tests/MetaCodableTests/ExplicitCodingTests.swift b/Tests/MetaCodableTests/ExplicitCodingTests.swift index ebd7f27d4c..31959165e3 100644 --- a/Tests/MetaCodableTests/ExplicitCodingTests.swift +++ b/Tests/MetaCodableTests/ExplicitCodingTests.swift @@ -14,7 +14,7 @@ struct ExplicitCodingTests { var value: String { "some" } } - @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #76)") + @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #76)", .tags(.codable, .codedIn, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -51,7 +51,7 @@ struct ExplicitCodingTests { ) } - @Test("Encodes to JSON successfully (ExplicitCodingTests #14)") + @Test("Encodes to JSON successfully (ExplicitCodingTests #14)", .tags(.encoding, .optionals)) func encodingOnly() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -61,7 +61,7 @@ struct ExplicitCodingTests { #expect(json["value"] as? String == "some") } - @Test("Decodes from JSON successfully (ExplicitCodingTests #48)") + @Test("Decodes from JSON successfully (ExplicitCodingTests #48)", .tags(.decoding)) func decodingEmpty() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -81,7 +81,7 @@ struct ExplicitCodingTests { } } - @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #77)") + @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #77)", .tags(.codable, .codedIn, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -126,7 +126,7 @@ struct ExplicitCodingTests { ) } - @Test("Encodes to JSON successfully (ExplicitCodingTests #15)") + @Test("Encodes to JSON successfully (ExplicitCodingTests #15)", .tags(.encoding, .optionals)) func encodingOnly() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -136,7 +136,7 @@ struct ExplicitCodingTests { #expect(json["value"] as? String == "some") } - @Test("Decodes from JSON successfully (ExplicitCodingTests #49)") + @Test("Decodes from JSON successfully (ExplicitCodingTests #49)", .tags(.decoding)) func decodingEmpty() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -157,7 +157,7 @@ struct ExplicitCodingTests { } } - @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #78)") + @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #78)", .tags(.codable, .codedIn, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -200,7 +200,7 @@ struct ExplicitCodingTests { ) } - @Test("Encodes to JSON successfully (ExplicitCodingTests #16)") + @Test("Encodes to JSON successfully (ExplicitCodingTests #16)", .tags(.encoding, .optionals)) func encodingOnly() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -210,7 +210,7 @@ struct ExplicitCodingTests { #expect(json["value"] as? String == "someVal") } - @Test("Decodes from JSON successfully (ExplicitCodingTests #50)") + @Test("Decodes from JSON successfully (ExplicitCodingTests #50)", .tags(.decoding)) func decodingEmpty() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -231,7 +231,7 @@ struct ExplicitCodingTests { } } - @Test("Generates macro expansion with @Codable for class (ExplicitCodingTests #4)") + @Test("Generates macro expansion with @Codable for class (ExplicitCodingTests #4)", .tags(.classes, .codable, .codedIn, .encoding, .enums, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -289,7 +289,7 @@ struct ExplicitCodingTests { } } - @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #79)") + @Test("Generates macro expansion with @Codable for struct (ExplicitCodingTests #79)", .tags(.codable, .codedIn, .encoding, .enums, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GenericsTests.swift b/Tests/MetaCodableTests/GenericsTests.swift index 2aded696e2..53397864b0 100644 --- a/Tests/MetaCodableTests/GenericsTests.swift +++ b/Tests/MetaCodableTests/GenericsTests.swift @@ -13,7 +13,7 @@ struct GenericsTests { let value: T } - @Test("Generates @Codable conformance for struct (GenericsTests #7)") + @Test("Generates @Codable conformance for struct (GenericsTests #7)", .tags(.codable, .decoding, .encoding, .enums, .generics, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -51,7 +51,7 @@ struct GenericsTests { ) } - @Test("Encodes and decodes successfully (GenericsTests #16)") + @Test("Encodes and decodes successfully (GenericsTests #16)", .tags(.decoding, .encoding, .generics)) func decodingAndEncoding() throws { let original = GenericCodable(value: "test") let encoded = try JSONEncoder().encode(original) @@ -60,7 +60,7 @@ struct GenericsTests { #expect(decoded.value == "test") } - @Test("Encodes and decodes successfully (GenericsTests #17)") + @Test("Encodes and decodes successfully (GenericsTests #17)", .tags(.decoding, .encoding, .generics)) func decodingAndEncodingWithInt() throws { let original = GenericCodable(value: 42) let encoded = try JSONEncoder().encode(original) @@ -69,7 +69,7 @@ struct GenericsTests { #expect(decoded.value == 42) } - @Test("Decodes from JSON successfully (GenericsTests #51)") + @Test("Decodes from JSON successfully (GenericsTests #51)", .tags(.decoding, .generics)) func decodingFromJSON() throws { let jsonStr = """ { @@ -92,7 +92,7 @@ struct GenericsTests { let value3: V } - @Test("Generates @Codable conformance for struct (GenericsTests #8)") + @Test("Generates @Codable conformance for struct (GenericsTests #8)", .tags(.codable, .decoding, .encoding, .enums, .generics, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -140,7 +140,7 @@ struct GenericsTests { ) } - @Test("Encodes and decodes successfully (GenericsTests #18)") + @Test("Encodes and decodes successfully (GenericsTests #18)", .tags(.decoding, .encoding, .generics)) func decodingAndEncoding() throws { let original = GenericCodable( value1: "test", value2: 42, value3: true) @@ -152,7 +152,7 @@ struct GenericsTests { #expect(decoded.value3 == true) } - @Test("Decodes from JSON successfully (GenericsTests #52)") + @Test("Decodes from JSON successfully (GenericsTests #52)", .tags(.decoding, .generics)) func decodingFromJSON() throws { let jsonStr = """ { @@ -179,7 +179,7 @@ struct GenericsTests { case three(V) } - @Test("Generates @Codable conformance for enum") + @Test("Generates @Codable conformance for enum", .tags(.codable, .encoding, .enums, .generics, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -259,7 +259,7 @@ struct GenericsTests { ) } - @Test("Encodes and decodes successfully (GenericsTests #19)") + @Test("Encodes and decodes successfully (GenericsTests #19)", .tags(.decoding, .encoding, .generics)) func decodingAndEncodingCaseOne() throws { let original: GenericCodable = .one("test") let encoded = try JSONEncoder().encode(original) @@ -272,7 +272,7 @@ struct GenericsTests { } } - @Test("Encodes and decodes successfully (GenericsTests #20)") + @Test("Encodes and decodes successfully (GenericsTests #20)", .tags(.decoding, .encoding, .generics)) func decodingAndEncodingCaseTwo() throws { let original: GenericCodable = .two(42) let encoded = try JSONEncoder().encode(original) @@ -285,7 +285,7 @@ struct GenericsTests { } } - @Test("Decodes from JSON successfully (GenericsTests #53)") + @Test("Decodes from JSON successfully (GenericsTests #53)", .tags(.decoding, .generics)) func decodingFromJSON() throws { let jsonStr = """ { @@ -311,7 +311,7 @@ struct GenericsTests { let str: String } - @Test("Generates @Codable conformance for struct (GenericsTests #9)") + @Test("Generates @Codable conformance for struct (GenericsTests #9)", .tags(.codable, .decoding, .encoding, .enums, .generics, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -363,7 +363,7 @@ struct GenericsTests { let str: String } - @Test("Generates @Codable conformance for class (GenericsTests #3)") + @Test("Generates @Codable conformance for class (GenericsTests #3)", .tags(.classes, .codable, .decoding, .encoding, .enums, .generics, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -416,7 +416,7 @@ struct GenericsTests { case two(String) } - @Test("Generates macro expansion with @Codable for enum (GenericsTests #16)") + @Test("Generates macro expansion with @Codable for enum (GenericsTests #16)", .tags(.codable, .encoding, .enums, .generics, .ignoreEncoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -493,7 +493,7 @@ struct GenericsTests { let str: String } - @Test("Generates @Codable conformance for struct (GenericsTests #10)") + @Test("Generates @Codable conformance for struct (GenericsTests #10)", .tags(.codable, .decoding, .encoding, .enums, .generics, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -543,7 +543,7 @@ struct GenericsTests { let str: String } - @Test("Generates macro expansion with @Codable for struct (GenericsTests #80)") + @Test("Generates macro expansion with @Codable for struct (GenericsTests #80)", .tags(.codable, .codedBy, .decoding, .encoding, .enums, .generics, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -597,7 +597,7 @@ struct GenericsTests { let str: String } - @Test("Generates macro expansion with @Codable for struct (GenericsTests #81)") + @Test("Generates macro expansion with @Codable for struct (GenericsTests #81)", .tags(.codable, .decoding, .encoding, .enums, .generics, .ignoreEncoding, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -650,7 +650,7 @@ struct GenericsTests { let str: String } - @Test("Generates macro expansion with @Codable for class (GenericsTests #5)") + @Test("Generates macro expansion with @Codable for class (GenericsTests #5)", .tags(.classes, .codable, .decoding, .encoding, .enums, .generics, .ignoreEncoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -703,7 +703,7 @@ struct GenericsTests { case two(String) } - @Test("Generates macro expansion with @Codable for enum (GenericsTests #17)") + @Test("Generates macro expansion with @Codable for enum (GenericsTests #17)", .tags(.codable, .encoding, .enums, .generics, .ignoreEncoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GroupedMutableVariableTests.swift b/Tests/MetaCodableTests/GroupedMutableVariableTests.swift index af08abb2b4..c4123c31d3 100644 --- a/Tests/MetaCodableTests/GroupedMutableVariableTests.swift +++ b/Tests/MetaCodableTests/GroupedMutableVariableTests.swift @@ -13,7 +13,7 @@ struct GroupedMutableVariableTests { var one, two, three: String } - @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #82)") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #82)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -73,7 +73,7 @@ struct GroupedMutableVariableTests { var one, two: String, three: String = "" } - @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #83)") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #83)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -138,7 +138,7 @@ struct GroupedMutableVariableTests { var one, two: String, three: Int } - @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #84)") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #84)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -240,7 +240,7 @@ struct GroupedMutableVariableTests { var one: String, two: String = "", three: Int } - @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #85)") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #85)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -297,7 +297,7 @@ struct GroupedMutableVariableTests { } } - @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #86)") + @Test("Generates macro expansion with @Codable for struct (GroupedMutableVariableTests #86)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func mixedTypesWithSomeInitializedWithoutExplicitTyping() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GroupedVariableTests.swift b/Tests/MetaCodableTests/GroupedVariableTests.swift index 75fbf3d8dd..a255f3e373 100644 --- a/Tests/MetaCodableTests/GroupedVariableTests.swift +++ b/Tests/MetaCodableTests/GroupedVariableTests.swift @@ -14,7 +14,7 @@ struct GroupedVariableTests { let one, two, three: String } - @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #87)") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #87)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -65,7 +65,7 @@ struct GroupedVariableTests { ) } - @Test("Encodes and decodes successfully (GroupedVariableTests #21)") + @Test("Encodes and decodes successfully (GroupedVariableTests #21)", .tags(.decoding, .encoding)) func decodingAndEncoding() throws { let original = SomeCodable( one: "first", two: "second", three: "third") @@ -77,7 +77,7 @@ struct GroupedVariableTests { #expect(decoded.three == "third") } - @Test("Decodes from JSON successfully (GroupedVariableTests #54)") + @Test("Decodes from JSON successfully (GroupedVariableTests #54)", .tags(.decoding)) func decodingFromJSON() throws { let jsonStr = """ { @@ -94,7 +94,7 @@ struct GroupedVariableTests { #expect(decoded.three == "value3") } - @Test("Encodes to JSON successfully (GroupedVariableTests #17)") + @Test("Encodes to JSON successfully (GroupedVariableTests #17)", .tags(.encoding, .optionals)) func encodingToJSON() throws { let original = SomeCodable(one: "a", two: "b", three: "c") let encoded = try JSONEncoder().encode(original) @@ -115,7 +115,7 @@ struct GroupedVariableTests { let one, two: String, three: String = "" } - @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #88)") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #88)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -173,7 +173,7 @@ struct GroupedVariableTests { let one, two: String, three: Int } - @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #89)") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #89)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -271,7 +271,7 @@ struct GroupedVariableTests { let one: String, two: String = "", three: Int } - @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #90)") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #90)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -329,7 +329,7 @@ struct GroupedVariableTests { let one: String, two = "", three: Int } - @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #91)") + @Test("Generates macro expansion with @Codable for struct (GroupedVariableTests #91)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/HelperCoderTests.swift b/Tests/MetaCodableTests/HelperCoderTests.swift index 5ef4edbb17..70df1e8595 100644 --- a/Tests/MetaCodableTests/HelperCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoderTests.swift @@ -34,7 +34,7 @@ struct HelperCoderTests { // MARK: - decodeIfPresent Tests /// Tests that `decodeIfPresent` returns a value when valid data is present. - @Test("Decodes struct from JSON successfully (HelperCoderTests #2)") + @Test("Decodes struct from JSON successfully (HelperCoderTests #2)", .tags(.decoding, .enums, .helperCoders, .optionals, .structs)) func decodeIfPresentWithValidData() throws { let json = #"{"value": "test"}"# let data = json.data(using: .utf8)! @@ -62,7 +62,7 @@ struct HelperCoderTests { } /// Tests that `decodeIfPresent` returns nil when data is null. - @Test("Decodes struct from JSON successfully (HelperCoderTests #3)") + @Test("Decodes struct from JSON successfully (HelperCoderTests #3)", .tags(.decoding, .enums, .helperCoders, .optionals, .structs)) func decodeIfPresentWithNullData() throws { let json = #"{"value": null}"# let data = json.data(using: .utf8)! @@ -90,7 +90,7 @@ struct HelperCoderTests { } /// Tests that `decodeIfPresent` returns nil when key is missing. - @Test("Decodes struct from JSON successfully (HelperCoderTests #4)") + @Test("Decodes struct from JSON successfully (HelperCoderTests #4)", .tags(.decoding, .enums, .helperCoders, .optionals, .structs)) func decodeIfPresentWithMissingKey() throws { let json = #"{}"# let data = json.data(using: .utf8)! @@ -120,7 +120,7 @@ struct HelperCoderTests { // MARK: - encode Tests /// Tests that `encode` works for Encodable types. - @Test("Encodes struct to JSON successfully (HelperCoderTests #2)") + @Test("Encodes struct to JSON successfully (HelperCoderTests #2)", .tags(.encoding, .enums, .helperCoders, .structs)) func encodeEncodableType() throws { struct Container: Encodable { let value: String @@ -145,7 +145,7 @@ struct HelperCoderTests { } /// Tests that `encode` does nothing for non-Encodable types (default implementation). - @Test("Encodes struct to JSON successfully (HelperCoderTests #3)") + @Test("Encodes struct to JSON successfully (HelperCoderTests #3)", .tags(.encoding, .enums, .helperCoders, .structs)) func encodeNonEncodableType() throws { struct Container: Encodable { let nonEncodable: NonEncodableValue @@ -174,7 +174,7 @@ struct HelperCoderTests { // MARK: - encodeIfPresent Tests /// Tests that `encodeIfPresent` encodes when value is present. - @Test("Encodes struct to JSON successfully (HelperCoderTests #4)") + @Test("Encodes struct to JSON successfully (HelperCoderTests #4)", .tags(.encoding, .enums, .helperCoders, .optionals, .structs)) func encodeIfPresentWithValue() throws { struct Container: Encodable { let value: String? @@ -199,7 +199,7 @@ struct HelperCoderTests { } /// Tests that `encodeIfPresent` skips encoding when value is nil. - @Test("Encodes struct to JSON successfully (HelperCoderTests #5)") + @Test("Encodes struct to JSON successfully (HelperCoderTests #5)", .tags(.encoding, .enums, .helperCoders, .optionals, .structs)) func encodeIfPresentWithNil() throws { struct Container: Encodable { let value: String? diff --git a/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift index cd8bf5283e..933c6fc12d 100644 --- a/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/DataCoderTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Data Coder Tests") struct DataCoderTests { - @Test("Encodes and decodes with JSON successfully (DataCoderTests #9)") + @Test("Encodes and decodes with JSON successfully (DataCoderTests #9)", .tags(.dataCoder, .decoding, .encoding)) func decoding() throws { let jsonStr = """ { @@ -20,7 +20,7 @@ struct DataCoderTests { #expect(newModel == model) } - @Test("Decodes from JSON successfully (DataCoderTests #55)") + @Test("Decodes from JSON successfully (DataCoderTests #55)", .tags(.dataCoder, .decoding)) func invalidDataDecoding() throws { let jsonStr = """ { diff --git a/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift index 1c04a67fb6..677bc320bb 100644 --- a/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/DateCoderTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Date Coder Tests") struct DateCoderTests { - @Test("Encodes and decodes with JSON successfully (DateCoderTests #10)") + @Test("Encodes and decodes with JSON successfully (DateCoderTests #10)", .tags(.dateCoder, .decoding, .encoding)) func decoding() throws { let jsonStr = """ { @@ -31,7 +31,7 @@ struct DateCoderTests { #expect(newModel == model) } - @Test("Decodes from JSON successfully (DateCoderTests #56)") + @Test("Decodes from JSON successfully (DateCoderTests #56)", .tags(.dateCoder, .decoding)) func invalidDecoding() throws { let jsonStr = """ { diff --git a/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift b/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift index 3564c47b49..66b7ea0b93 100644 --- a/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/HelperCodersTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Helper Coders Tests") struct HelperCodersTests { - @Test("Encodes and decodes with JSON successfully (HelperCodersTests #11)") + @Test("Encodes and decodes with JSON successfully (HelperCodersTests #11)", .tags(.decoding, .encoding, .helperCoders, .optionals)) func conditionalAndOptionalCoding() throws { let jsonStr = """ { @@ -25,7 +25,7 @@ struct HelperCodersTests { #expect(model.optionalDate == nil) } - @Test("Encodes and decodes with JSON successfully (HelperCodersTests #12)") + @Test("Encodes and decodes with JSON successfully (HelperCodersTests #12)", .tags(.decoding, .encoding, .helperCoders, .optionals)) func propertyWrapperCoding() throws { let jsonStr = """ { diff --git a/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift b/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift index cdacc73c95..af34a9c17e 100644 --- a/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Lossy Sequence Tests") struct LossySequenceTests { @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Decodes from JSON successfully (LossySequenceTests #57)") + @Test("Decodes from JSON successfully (LossySequenceTests #57)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func invalidDataType() throws { #expect(throws: DecodingError.self) { @@ -15,7 +15,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Decodes from JSON successfully (LossySequenceTests #58)") + @Test("Decodes from JSON successfully (LossySequenceTests #58)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func emptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! @@ -24,7 +24,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Encodes and decodes successfully (LossySequenceTests #22)") + @Test("Encodes and decodes successfully (LossySequenceTests #22)", .tags(.decoding, .encoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func validData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! @@ -35,7 +35,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Decodes from JSON successfully (LossySequenceTests #59)") + @Test("Decodes from JSON successfully (LossySequenceTests #59)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func invalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -44,7 +44,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Decodes from JSON successfully (LossySequenceTests #60)") + @Test("Decodes from JSON successfully (LossySequenceTests #60)", .tags(.decoding, .lossySequence, .optionals)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalInvalidDataType() throws { #expect(throws: DecodingError.self) { @@ -56,7 +56,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Decodes from JSON successfully (LossySequenceTests #61)") + @Test("Decodes from JSON successfully (LossySequenceTests #61)", .tags(.decoding, .lossySequence, .optionals)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalEmptyData() throws { let json = "{}".data(using: .utf8)! @@ -65,7 +65,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Encodes and decodes successfully (LossySequenceTests #23)") + @Test("Encodes and decodes successfully (LossySequenceTests #23)", .tags(.decoding, .encoding, .lossySequence, .optionals)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! @@ -76,7 +76,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Decodes from JSON successfully (LossySequenceTests #62)") + @Test("Decodes from JSON successfully (LossySequenceTests #62)", .tags(.decoding, .lossySequence, .optionals)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -85,7 +85,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Decodes from JSON successfully (LossySequenceTests #63)") + @Test("Decodes from JSON successfully (LossySequenceTests #63)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultInvalidDataType() throws { let json = #"{"data":1}"#.data(using: .utf8)! @@ -94,7 +94,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Decodes from JSON successfully (LossySequenceTests #64)") + @Test("Decodes from JSON successfully (LossySequenceTests #64)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! @@ -103,7 +103,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Encodes and decodes successfully (LossySequenceTests #24)") + @Test("Encodes and decodes successfully (LossySequenceTests #24)", .tags(.decoding, .encoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! @@ -114,7 +114,7 @@ struct LossySequenceTests { } @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") - @Test("Decodes from JSON successfully (LossySequenceTests #65)") + @Test("Decodes from JSON successfully (LossySequenceTests #65)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! diff --git a/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift index 80a5aeb0fc..ea246cc184 100644 --- a/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/NonConformingCoderTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Non Conforming Coder Tests") struct NonConformingCoderTests { - @Test("Encodes and decodes successfully (NonConformingCoderTests #25)") + @Test("Encodes and decodes successfully (NonConformingCoderTests #25)", .tags(.decoding, .encoding, .nonConformingCoder)) func testDecodingActualFloat() throws { let json = try mockJSON(5.5) let model = try JSONDecoder().decode(Model.self, from: json) @@ -15,7 +15,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == 5.5) } - @Test("Encodes and decodes successfully (NonConformingCoderTests #26)") + @Test("Encodes and decodes successfully (NonConformingCoderTests #26)", .tags(.decoding, .encoding, .nonConformingCoder)) func testDecodingStringifiedFloat() throws { let json = try mockJSON("5.5") let model = try JSONDecoder().decode(Model.self, from: json) @@ -25,7 +25,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == 5.5) } - @Test("Encodes and decodes successfully (NonConformingCoderTests #27)") + @Test("Encodes and decodes successfully (NonConformingCoderTests #27)", .tags(.decoding, .encoding, .nonConformingCoder)) func testDecodingPositiveInfinity() throws { let json = try mockJSON("➕♾️") let model = try JSONDecoder().decode(Model.self, from: json) @@ -35,7 +35,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == .infinity) } - @Test("Encodes and decodes successfully (NonConformingCoderTests #28)") + @Test("Encodes and decodes successfully (NonConformingCoderTests #28)", .tags(.decoding, .encoding, .nonConformingCoder)) func testDecodingNegativeInfinity() throws { let json = try mockJSON("➖♾️") let model = try JSONDecoder().decode(Model.self, from: json) @@ -45,7 +45,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float == -.infinity) } - @Test("Encodes and decodes successfully (NonConformingCoderTests #29)") + @Test("Encodes and decodes successfully (NonConformingCoderTests #29)", .tags(.decoding, .encoding, .nonConformingCoder)) func testDecodingNotANumber() throws { let json = try mockJSON("😞") let model = try JSONDecoder().decode(Model.self, from: json) @@ -55,7 +55,7 @@ struct NonConformingCoderTests { #expect(parsedModel.float.isNaN) } - @Test("Decodes from JSON successfully (NonConformingCoderTests #66)") + @Test("Decodes from JSON successfully (NonConformingCoderTests #66)", .tags(.decoding, .nonConformingCoder)) func invalidDecoding() throws { let json = try mockJSON("random") #expect(throws: DecodingError.self) { diff --git a/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift index 05df5c0ce6..10e54b5268 100644 --- a/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/SequenceCoderTests.swift @@ -8,7 +8,7 @@ struct SequenceCoderTests { let decoder = JSONDecoder() let encoder = JSONEncoder() - @Test("Decodes from JSON successfully (SequenceCoderTests #67)") + @Test("Decodes from JSON successfully (SequenceCoderTests #67)", .tags(.decoding, .sequenceCoder)) func invalidDataType() throws { #expect(throws: DecodingError.self) { let json = #"{"data":1}"#.data(using: .utf8)! @@ -16,14 +16,14 @@ struct SequenceCoderTests { } } - @Test("Decodes from JSON successfully (SequenceCoderTests #68)") + @Test("Decodes from JSON successfully (SequenceCoderTests #68)", .tags(.decoding, .sequenceCoder)) func emptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(Container.self, from: json) #expect(val.data.isEmpty) } - @Test("Encodes and decodes successfully (SequenceCoderTests #30)") + @Test("Encodes and decodes successfully (SequenceCoderTests #30)", .tags(.decoding, .encoding, .sequenceCoder)) func validData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(Container.self, from: json) @@ -32,7 +32,7 @@ struct SequenceCoderTests { #expect(data == json) } - @Test("Decodes from JSON successfully (SequenceCoderTests #69)") + @Test("Decodes from JSON successfully (SequenceCoderTests #69)", .tags(.decoding, .sequenceCoder)) func invalidData() throws { #expect(throws: DecodingError.self) { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -40,7 +40,7 @@ struct SequenceCoderTests { } } - @Test("Decodes from JSON successfully (SequenceCoderTests #70)") + @Test("Decodes from JSON successfully (SequenceCoderTests #70)", .tags(.decoding, .sequenceCoder)) func lossyInvalidDataType() throws { #expect(throws: DecodingError.self) { let json = #"{"data":1}"#.data(using: .utf8)! @@ -48,14 +48,14 @@ struct SequenceCoderTests { } } - @Test("Decodes from JSON successfully (SequenceCoderTests #71)") + @Test("Decodes from JSON successfully (SequenceCoderTests #71)", .tags(.decoding, .sequenceCoder)) func lossyEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(LossyContainer.self, from: json) #expect(val.data.isEmpty) } - @Test("Encodes and decodes successfully (SequenceCoderTests #31)") + @Test("Encodes and decodes successfully (SequenceCoderTests #31)", .tags(.decoding, .encoding, .sequenceCoder)) func lossyValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyContainer.self, from: json) @@ -64,28 +64,28 @@ struct SequenceCoderTests { #expect(data == json) } - @Test("Decodes from JSON successfully (SequenceCoderTests #72)") + @Test("Decodes from JSON successfully (SequenceCoderTests #72)", .tags(.decoding, .sequenceCoder)) func lossyInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyContainer.self, from: json) #expect(val.data == ["1", "2"]) } - @Test("Decodes from JSON successfully (SequenceCoderTests #73)") + @Test("Decodes from JSON successfully (SequenceCoderTests #73)", .tags(.decoding, .sequenceCoder)) func defaultInvalidDataType() throws { let json = #"{"data":1}"#.data(using: .utf8)! let val = try decoder.decode(DefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test("Decodes from JSON successfully (SequenceCoderTests #74)") + @Test("Decodes from JSON successfully (SequenceCoderTests #74)", .tags(.decoding, .sequenceCoder)) func defaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(DefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test("Encodes and decodes successfully (SequenceCoderTests #32)") + @Test("Encodes and decodes successfully (SequenceCoderTests #32)", .tags(.decoding, .encoding, .sequenceCoder)) func defaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(DefaultContainer.self, from: json) @@ -94,7 +94,7 @@ struct SequenceCoderTests { #expect(data == json) } - @Test("Decodes from JSON successfully (SequenceCoderTests #75)") + @Test("Decodes from JSON successfully (SequenceCoderTests #75)", .tags(.decoding, .sequenceCoder)) func defaultInvalidData() throws { #expect(throws: DecodingError.self) { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! @@ -102,21 +102,21 @@ struct SequenceCoderTests { } } - @Test("Decodes from JSON successfully (SequenceCoderTests #76)") + @Test("Decodes from JSON successfully (SequenceCoderTests #76)", .tags(.decoding, .sequenceCoder)) func lossyDefaultInvalidDataType() throws { let json = #"{"data":1}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test("Decodes from JSON successfully (SequenceCoderTests #77)") + @Test("Decodes from JSON successfully (SequenceCoderTests #77)", .tags(.decoding, .sequenceCoder)) func lossyDefaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) #expect(val.data == ["some"]) } - @Test("Encodes and decodes successfully (SequenceCoderTests #33)") + @Test("Encodes and decodes successfully (SequenceCoderTests #33)", .tags(.decoding, .encoding, .sequenceCoder)) func lossyDefaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) @@ -125,7 +125,7 @@ struct SequenceCoderTests { #expect(data == json) } - @Test("Encodes and decodes successfully (SequenceCoderTests #34)") + @Test("Encodes and decodes successfully (SequenceCoderTests #34)", .tags(.decoding, .encoding, .sequenceCoder)) func lossyDefaultInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! let val = try decoder.decode(LossyDefaultContainer.self, from: json) diff --git a/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift b/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift index 72f227fefc..f37c8a016c 100644 --- a/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/ValueCoderTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Value Coder Tests") struct ValueCoderTests { - @Test("Encodes and decodes successfully (ValueCoderTests #35)") + @Test("Encodes and decodes successfully (ValueCoderTests #35)", .tags(.decoding, .encoding, .valueCoder)) func actualTypeDecoding() throws { let json = try mockJSON(true, 5, 5.5, "some") let model = try JSONDecoder().decode(Model.self, from: json) @@ -22,7 +22,7 @@ struct ValueCoderTests { } // MARK: Bool - @Test("Decodes from JSON successfully (ValueCoderTests #78)") + @Test("Decodes from JSON successfully (ValueCoderTests #78)", .tags(.decoding, .valueCoder)) func intToBooleanDecoding() throws { let json1 = try mockJSON(1, 5, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -32,7 +32,7 @@ struct ValueCoderTests { #expect(!model2.bool) } - @Test("Decodes from JSON successfully (ValueCoderTests #79)") + @Test("Decodes from JSON successfully (ValueCoderTests #79)", .tags(.decoding, .valueCoder)) func intToBooleanDecodingFailure() throws { #expect(throws: DecodingError.self) { let json = try mockJSON(2, 5, 5.5, "some") @@ -40,7 +40,7 @@ struct ValueCoderTests { } } - @Test("Decodes from JSON successfully (ValueCoderTests #80)") + @Test("Decodes from JSON successfully (ValueCoderTests #80)", .tags(.decoding, .valueCoder)) func floatToBooleanDecoding() throws { let json1 = try mockJSON(1.0, 5, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -50,7 +50,7 @@ struct ValueCoderTests { #expect(!model2.bool) } - @Test("Decodes from JSON successfully (ValueCoderTests #81)") + @Test("Decodes from JSON successfully (ValueCoderTests #81)", .tags(.decoding, .valueCoder)) func floatToBooleanDecodingFailure() throws { #expect(throws: DecodingError.self) { let json = try mockJSON(1.1, 5, 5.5, "some") @@ -81,7 +81,7 @@ struct ValueCoderTests { } // MARK: Int - @Test("Decodes from JSON successfully (ValueCoderTests #82)") + @Test("Decodes from JSON successfully (ValueCoderTests #82)", .tags(.decoding, .valueCoder)) func boolToIntDecoding() throws { let json1 = try mockJSON(true, true, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -91,7 +91,7 @@ struct ValueCoderTests { #expect(model2.int == 0) } - @Test("Decodes from JSON successfully (ValueCoderTests #83)") + @Test("Decodes from JSON successfully (ValueCoderTests #83)", .tags(.decoding, .valueCoder)) func floatToIntDecoding() throws { let json1 = try mockJSON(true, 5.0, 5.5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -101,7 +101,7 @@ struct ValueCoderTests { #expect(model2.int == 0) } - @Test("Decodes from JSON successfully (ValueCoderTests #84)") + @Test("Decodes from JSON successfully (ValueCoderTests #84)", .tags(.decoding, .valueCoder)) func floatToIntDecodingFailure() throws { #expect(throws: DecodingError.self) { let json = try mockJSON(true, 5.5, 5.5, "some") @@ -125,7 +125,7 @@ struct ValueCoderTests { } // MARK: Float - @Test("Decodes from JSON successfully (ValueCoderTests #85)") + @Test("Decodes from JSON successfully (ValueCoderTests #85)", .tags(.decoding, .valueCoder)) func boolToFloatDecoding() throws { let json1 = try mockJSON(true, 5, true, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -135,7 +135,7 @@ struct ValueCoderTests { #expect(model2.double == 0) } - @Test("Decodes from JSON successfully (ValueCoderTests #86)") + @Test("Decodes from JSON successfully (ValueCoderTests #86)", .tags(.decoding, .valueCoder)) func intToFloatDecoding() throws { let json1 = try mockJSON(true, 5, 5, "some") let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -161,7 +161,7 @@ struct ValueCoderTests { } // MARK: String - @Test("Decodes from JSON successfully (ValueCoderTests #87)") + @Test("Decodes from JSON successfully (ValueCoderTests #87)", .tags(.decoding, .valueCoder)) func boolToStringDecoding() throws { let json1 = try mockJSON(true, 5, 5.5, true) let model1 = try JSONDecoder().decode(Model.self, from: json1) @@ -171,7 +171,7 @@ struct ValueCoderTests { #expect(model2.string == "false") } - @Test("Decodes from JSON successfully (ValueCoderTests #88)") + @Test("Decodes from JSON successfully (ValueCoderTests #88)", .tags(.decoding, .valueCoder)) func intToStringDecoding() throws { let json1 = try mockJSON(true, 5, 5.5, 5) let model1 = try JSONDecoder().decode(Model.self, from: json1) diff --git a/Tests/MetaCodableTests/IgnoreCodingTests.swift b/Tests/MetaCodableTests/IgnoreCodingTests.swift index 5fbfb750c4..96e251af1c 100644 --- a/Tests/MetaCodableTests/IgnoreCodingTests.swift +++ b/Tests/MetaCodableTests/IgnoreCodingTests.swift @@ -6,7 +6,7 @@ import Testing @Suite("Ignore Coding Tests") struct IgnoreCodingTests { - @Test("Reports error for @Codable misuse (IgnoreCodingTests #5)") + @Test("Reports error for @Codable misuse (IgnoreCodingTests #5)", .tags(.codable, .encoding, .enums, .errorHandling, .ignoreCoding, .ignoreDecoding, .macroExpansion, .optionals, .structs)) func misuseOnUninitializedVariable() throws { assertMacroExpansion( """ @@ -97,7 +97,7 @@ struct IgnoreCodingTests { ) } - @Test("Reports error for @Codable misuse (IgnoreCodingTests #6)") + @Test("Reports error for @Codable misuse (IgnoreCodingTests #6)", .tags(.codable, .codedAt, .errorHandling, .ignoreCoding, .macroExpansion, .structs)) func misuseWithInvalidCombination() throws { assertMacroExpansion( """ @@ -155,7 +155,7 @@ struct IgnoreCodingTests { var one: String = "some" } - @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #92)") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #92)", .tags(.codable, .ignoreCoding, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -184,7 +184,7 @@ struct IgnoreCodingTests { ) } - @Test("Encodes to JSON successfully (IgnoreCodingTests #18)") + @Test("Encodes to JSON successfully (IgnoreCodingTests #18)", .tags(.encoding, .ignoreCoding)) func ignoreCodingBehavior() throws { let original = SomeCodable() #expect(original.one == "some") // Default value @@ -196,7 +196,7 @@ struct IgnoreCodingTests { } } - @Test("Decodes from JSON successfully (IgnoreCodingTests #89)") + @Test("Decodes from JSON successfully (IgnoreCodingTests #89)", .tags(.decoding, .ignoreCoding)) func ignoreCodingFromJSON() throws { let jsonStr = """ { @@ -223,7 +223,7 @@ struct IgnoreCodingTests { let four: String } - @Test("Generates macro expansion with @Codable for struct with optional properties") + @Test("Generates macro expansion with @Codable for struct with optional properties", .tags(.codable, .decoding, .encoding, .enums, .ignoreCoding, .macroExpansion, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -270,7 +270,7 @@ struct IgnoreCodingTests { ) } - @Test("Decodes from JSON successfully (IgnoreCodingTests #90)") + @Test("Decodes from JSON successfully (IgnoreCodingTests #90)", .tags(.decoding, .ignoreCoding)) func decoding() throws { let json = try #require("{\"four\":\"som\"}".data(using: .utf8)) let obj = try JSONDecoder().decode(SomeCodable.self, from: json) @@ -280,7 +280,7 @@ struct IgnoreCodingTests { #expect(obj.four == "som") } - @Test("Encodes to JSON successfully (IgnoreCodingTests #19)") + @Test("Encodes to JSON successfully (IgnoreCodingTests #19)", .tags(.encoding, .ignoreCoding, .optionals)) func encoding() throws { let obj = SomeCodable(one: "one", two: "two", four: "some") let json = try JSONEncoder().encode(obj) @@ -300,7 +300,7 @@ struct IgnoreCodingTests { case bool(_ variableBool: Bool) } - @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #18)") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #18)", .tags(.codable, .enums, .ignoreCoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -343,7 +343,7 @@ struct IgnoreCodingTests { var one: String = "some" } - @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #93)") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #93)", .tags(.codable, .encoding, .enums, .ignoreCoding, .ignoreDecoding, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -389,7 +389,7 @@ struct IgnoreCodingTests { case bool(_ variableBool: Bool) } - @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #19)") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #19)", .tags(.codable, .encoding, .enums, .ignoreCoding, .ignoreDecoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -448,7 +448,7 @@ struct IgnoreCodingTests { var two: String } - @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #94)") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #94)", .tags(.codable, .decoding, .enums, .ignoreCoding, .ignoreEncoding, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -501,7 +501,7 @@ struct IgnoreCodingTests { var two: String } - @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #95)") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #95)", .tags(.codable, .decoding, .encoding, .enums, .ignoreCoding, .ignoreEncoding, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -549,7 +549,7 @@ struct IgnoreCodingTests { ) } - @Test("Encodes to JSON successfully (IgnoreCodingTests #20)") + @Test("Encodes to JSON successfully (IgnoreCodingTests #20)", .tags(.encoding, .ignoreCoding, .optionals)) func ignore() throws { let obj = SomeCodable(one: "", two: "") let data = try JSONEncoder().encode(obj) @@ -559,7 +559,7 @@ struct IgnoreCodingTests { #expect(dict["two"] == nil) } - @Test("Encodes to JSON successfully (IgnoreCodingTests #21)") + @Test("Encodes to JSON successfully (IgnoreCodingTests #21)", .tags(.encoding, .ignoreCoding, .optionals)) func encode() throws { let obj = SomeCodable(one: "some", two: "some") let data = try JSONEncoder().encode(obj) @@ -569,7 +569,7 @@ struct IgnoreCodingTests { #expect(dict["two"] == "some") } - @Test("Decodes from JSON successfully (IgnoreCodingTests #91)") + @Test("Decodes from JSON successfully (IgnoreCodingTests #91)", .tags(.decoding, .ignoreCoding)) func decode() throws { let json = "{\"one\": \"\", \"two\": \"\"}".data(using: .utf8)! let obj = try JSONDecoder().decode(SomeCodable.self, from: json) @@ -586,7 +586,7 @@ struct IgnoreCodingTests { case bool(_ variableBool: Bool) } - @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #20)") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #20)", .tags(.codable, .decoding, .enums, .ignoreCoding, .ignoreEncoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -651,7 +651,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #21)") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #21)", .tags(.codable, .decoding, .encoding, .enums, .ignoreCoding, .ignoreEncoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -767,7 +767,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #22)") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #22)", .tags(.codable, .decoding, .encoding, .enums, .ignoreCoding, .ignoreEncoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -876,7 +876,7 @@ struct IgnoreCodingTests { var four: String = "some" } - @Test("Generates macro expansion with @Codable for struct with nested paths (IgnoreCodingTests #83)") + @Test("Generates macro expansion with @Codable for struct with nested paths (IgnoreCodingTests #83)", .tags(.codable, .codedAt, .codedIn, .decoding, .encoding, .enums, .ignoreCoding, .ignoreDecoding, .ignoreEncoding, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -957,7 +957,7 @@ struct IgnoreCodingTests { var four: String = "some" } - @Test("Generates macro expansion with @Codable for class with nested paths (IgnoreCodingTests #12)") + @Test("Generates macro expansion with @Codable for class with nested paths (IgnoreCodingTests #12)", .tags(.classes, .codable, .codedAt, .codedIn, .decoding, .encoding, .enums, .ignoreCoding, .ignoreDecoding, .ignoreEncoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -1036,7 +1036,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #23)") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #23)", .tags(.codable, .codedAs, .decoding, .encoding, .enums, .ignoreCoding, .ignoreDecoding, .ignoreEncoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -1133,7 +1133,7 @@ struct IgnoreCodingTests { var shouldIgnoreTwo: Bool } - @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #96)") + @Test("Generates macro expansion with @Codable for struct (IgnoreCodingTests #96)", .tags(.codable, .decoding, .encoding, .enums, .ignoreCoding, .ignoreEncoding, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -1186,7 +1186,7 @@ struct IgnoreCodingTests { ) } - @Test("Encodes to JSON successfully (IgnoreCodingTests #22)") + @Test("Encodes to JSON successfully (IgnoreCodingTests #22)", .tags(.encoding, .ignoreCoding, .optionals)) func ignore() throws { let obj = SomeCodable( one: "", two: "ignored", shouldIgnoreTwo: true) @@ -1198,7 +1198,7 @@ struct IgnoreCodingTests { #expect(dict["shouldIgnoreTwo"] as? Bool == true) } - @Test("Encodes to JSON successfully (IgnoreCodingTests #23)") + @Test("Encodes to JSON successfully (IgnoreCodingTests #23)", .tags(.encoding, .ignoreCoding, .optionals)) func encode() throws { let obj = SomeCodable( one: "some", two: "some", shouldIgnoreTwo: false) @@ -1210,7 +1210,7 @@ struct IgnoreCodingTests { #expect(dict["shouldIgnoreTwo"] as? Bool == false) } - @Test("Decodes from JSON successfully (IgnoreCodingTests #92)") + @Test("Decodes from JSON successfully (IgnoreCodingTests #92)", .tags(.decoding, .ignoreCoding)) func decode() throws { let json = "{\"one\": \"\", \"two\": \"value\", \"shouldIgnoreTwo\": true}" @@ -1232,7 +1232,7 @@ struct IgnoreCodingTests { case multi(_ variable: Bool, val: Int, String) } - @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #24)") + @Test("Generates macro expansion with @Codable for enum (IgnoreCodingTests #24)", .tags(.codable, .decoding, .encoding, .enums, .ignoreCoding, .ignoreEncoding, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/IgnoreInitializedTests.swift b/Tests/MetaCodableTests/IgnoreInitializedTests.swift index 66e2ae2363..10217c25da 100644 --- a/Tests/MetaCodableTests/IgnoreInitializedTests.swift +++ b/Tests/MetaCodableTests/IgnoreInitializedTests.swift @@ -5,7 +5,7 @@ import Testing @Suite("Ignore Initialized Tests") struct IgnoreInitializedTests { - @Test("Reports error when @IgnoreCodingInitialized is used without @Codable") + @Test("Reports error when @IgnoreCodingInitialized is used without @Codable", .tags(.codable, .errorHandling, .ignoreCoding, .ignoreCodingInitialized, .macroExpansion, .structs)) func misuse() throws { assertMacroExpansion( """ @@ -44,7 +44,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #97)") + @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #97)", .tags(.codable, .ignoreCoding, .ignoreCodingInitialized, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -82,7 +82,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("Generates macro expansion with @Codable for class (IgnoreInitializedTests #6)") + @Test("Generates macro expansion with @Codable for class (IgnoreInitializedTests #6)", .tags(.classes, .codable, .ignoreCoding, .ignoreCodingInitialized, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -128,7 +128,7 @@ struct IgnoreInitializedTests { case multi(_ variable: Bool, val: Int, String = "text") } - @Test("Generates macro expansion with @Codable for enum (IgnoreInitializedTests #25)") + @Test("Generates macro expansion with @Codable for enum (IgnoreInitializedTests #25)", .tags(.codable, .codedAs, .decoding, .encoding, .enums, .ignoreCoding, .ignoreCodingInitialized, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -239,7 +239,7 @@ struct IgnoreInitializedTests { case multi(_ variable: Bool, val: Int, String = "text") } - @Test("Generates macro expansion with @Codable for enum (IgnoreInitializedTests #26)") + @Test("Generates macro expansion with @Codable for enum (IgnoreInitializedTests #26)", .tags(.codable, .codedAs, .decoding, .encoding, .enums, .ignoreCoding, .ignoreCodingInitialized, .macroExpansion)) func expansion() throws { assertMacroExpansion( """ @@ -348,7 +348,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #98)") + @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #98)", .tags(.codable, .codedIn, .decoding, .encoding, .enums, .ignoreCoding, .ignoreCodingInitialized, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -399,7 +399,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #99)") + @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #99)", .tags(.codable, .codedIn, .encoding, .enums, .ignoreCoding, .ignoreCodingInitialized, .ignoreDecoding, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -449,7 +449,7 @@ struct IgnoreInitializedTests { var one: String = "some" } - @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #100)") + @Test("Generates macro expansion with @Codable for struct (IgnoreInitializedTests #100)", .tags(.codable, .codedIn, .decoding, .enums, .ignoreCoding, .ignoreCodingInitialized, .ignoreEncoding, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/RawRepresentableEnumTests.swift b/Tests/MetaCodableTests/RawRepresentableEnumTests.swift index 72c163c15c..d660794412 100644 --- a/Tests/MetaCodableTests/RawRepresentableEnumTests.swift +++ b/Tests/MetaCodableTests/RawRepresentableEnumTests.swift @@ -17,7 +17,7 @@ struct RawRepresentableEnumTests { case pending = "pending" } - @Test("Generates @Codable conformance for enum (RawRepresentableEnumTests #1)") + @Test("Generates @Codable conformance for enum (RawRepresentableEnumTests #1)", .tags(.codable, .encoding, .enums, .macroExpansion, .optionals, .rawRepresentable)) func expansion() throws { assertMacroExpansion( """ @@ -120,7 +120,7 @@ struct RawRepresentableEnumTests { #expect(decoded == status) } - @Test("Decodes from JSON successfully (RawRepresentableEnumTests #93)") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #93)", .tags(.decoding, .rawRepresentable)) func directDecoding() throws { let jsonString = "\"active\"" let jsonData = jsonString.data(using: .utf8)! @@ -141,7 +141,7 @@ struct RawRepresentableEnumTests { case high = 3 } - @Test("Generates @Codable conformance for enum (RawRepresentableEnumTests #2)") + @Test("Generates @Codable conformance for enum (RawRepresentableEnumTests #2)", .tags(.codable, .encoding, .enums, .macroExpansion, .optionals, .rawRepresentable)) func expansion() throws { assertMacroExpansion( """ @@ -267,7 +267,7 @@ struct RawRepresentableEnumTests { case advanced = "advanced" } - @Test("Generates macro expansion with @Codable for enum (RawRepresentableEnumTests #27)") + @Test("Generates macro expansion with @Codable for enum (RawRepresentableEnumTests #27)", .tags(.codable, .codedAt, .decoding, .encoding, .enums, .macroExpansion, .optionals, .rawRepresentable)) func expansion() throws { assertMacroExpansion( """ @@ -627,7 +627,7 @@ struct RawRepresentableEnumTests { // MARK: - Error Cases - @Test("Decodes from JSON successfully (RawRepresentableEnumTests #94)") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #94)", .tags(.decoding, .rawRepresentable)) func invalidCodedAsValueDecoding() throws { let jsonString = "\"INVALID\"" let jsonData = jsonString.data(using: .utf8)! @@ -638,7 +638,7 @@ struct RawRepresentableEnumTests { } } - @Test("Decodes from JSON successfully (RawRepresentableEnumTests #95)") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #95)", .tags(.decoding, .rawRepresentable)) func invalidResponseCodeDecoding() throws { let jsonString = "999" // Not in any CodedAs range let jsonData = jsonString.data(using: .utf8)! @@ -651,7 +651,7 @@ struct RawRepresentableEnumTests { // MARK: - Array and Collection Tests - @Test("Decodes from JSON successfully (RawRepresentableEnumTests #96)") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #96)", .tags(.decoding, .rawRepresentable)) func httpMethodArrayDecoding() throws { // Test that we can decode arrays with mixed CodedAs and raw values let jsonString = """ @@ -669,7 +669,7 @@ struct RawRepresentableEnumTests { #expect(decoded == expected) } - @Test("Decodes from JSON successfully (RawRepresentableEnumTests #97)") + @Test("Decodes from JSON successfully (RawRepresentableEnumTests #97)", .tags(.decoding, .rawRepresentable)) func responseCodeArrayDecoding() throws { // Test decoding array of response codes with CodedAs values let jsonString = """ diff --git a/Tests/MetaCodableTests/Tags.swift b/Tests/MetaCodableTests/Tags.swift new file mode 100644 index 0000000000..783c522b80 --- /dev/null +++ b/Tests/MetaCodableTests/Tags.swift @@ -0,0 +1,128 @@ +import Testing + +/// Test tags for organizing and filtering MetaCodable tests. +extension Tag { + // MARK: - Macro Tags + + /// Tests for @Codable macro + @Tag static var codable: Self + + /// Tests for @CodedAt macro + @Tag static var codedAt: Self + + /// Tests for @CodedIn macro + @Tag static var codedIn: Self + + /// Tests for @CodedBy macro + @Tag static var codedBy: Self + + /// Tests for @CodedAs macro + @Tag static var codedAs: Self + + /// Tests for @CodingKeys macro + @Tag static var codingKeys: Self + + /// Tests for @Default macro + @Tag static var `default`: Self + + /// Tests for @IgnoreCoding macro + @Tag static var ignoreCoding: Self + + /// Tests for @IgnoreDecoding macro + @Tag static var ignoreDecoding: Self + + /// Tests for @IgnoreEncoding macro + @Tag static var ignoreEncoding: Self + + /// Tests for @IgnoreCodingInitialized macro + @Tag static var ignoreCodingInitialized: Self + + /// Tests for @ContentAt macro + @Tag static var contentAt: Self + + /// Tests for @UnTagged macro + @Tag static var untagged: Self + + /// Tests for @MemberInit macro + @Tag static var memberInit: Self + + /// Tests for @Inherits macro + @Tag static var inherits: Self + + // MARK: - Test Type Tags + + /// Tests that verify macro expansion output + @Tag static var macroExpansion: Self + + /// Tests for encoding functionality + @Tag static var encoding: Self + + /// Tests for decoding functionality + @Tag static var decoding: Self + + /// Tests for error handling and diagnostics + @Tag static var errorHandling: Self + + /// Integration tests combining multiple features + @Tag static var integration: Self + + // MARK: - Feature Tags + + /// Tests for HelperCoder and related types + @Tag static var helperCoders: Self + + /// Tests for dynamic coding features + @Tag static var dynamicCoding: Self + + /// Tests for inheritance support + @Tag static var inheritance: Self + + /// Tests for generics support + @Tag static var generics: Self + + /// Tests for access modifier handling + @Tag static var accessModifiers: Self + + /// Tests for optional/nil handling + @Tag static var optionals: Self + + /// Tests for enum types + @Tag static var enums: Self + + /// Tests for struct types + @Tag static var structs: Self + + /// Tests for class types + @Tag static var classes: Self + + /// Tests for raw representable types + @Tag static var rawRepresentable: Self + + // MARK: - Coverage Tags + + /// Tests created specifically for coverage improvement + @Tag static var coverage: Self + + // MARK: - Helper Coder Tags + + /// Tests for date coders + @Tag static var dateCoder: Self + + /// Tests for data coders (Base64) + @Tag static var dataCoder: Self + + /// Tests for sequence coders + @Tag static var sequenceCoder: Self + + /// Tests for lossy sequence handling + @Tag static var lossySequence: Self + + /// Tests for value coders + @Tag static var valueCoder: Self + + /// Tests for non-conforming coders + @Tag static var nonConformingCoder: Self + + /// Tests for conditional coders + @Tag static var conditionalCoder: Self +} diff --git a/Tests/MetaCodableTests/UntaggedEnumTests.swift b/Tests/MetaCodableTests/UntaggedEnumTests.swift index a8f00e2cec..40172afdbb 100644 --- a/Tests/MetaCodableTests/UntaggedEnumTests.swift +++ b/Tests/MetaCodableTests/UntaggedEnumTests.swift @@ -7,7 +7,7 @@ import XCTest @Suite("Untagged Enum Tests") struct UntaggedEnumTests { - @Test("Reports error for @Codable misuse (UntaggedEnumTests #7)") + @Test("Reports error for @Codable misuse (UntaggedEnumTests #7)", .tags(.codable, .decoding, .encoding, .enums, .errorHandling, .macroExpansion, .structs, .untagged)) func misuseOnNonEnumDeclaration() throws { assertMacroExpansion( """ @@ -57,7 +57,7 @@ struct UntaggedEnumTests { ) } - @Test("Reports error for @Codable misuse (UntaggedEnumTests #8)") + @Test("Reports error for @Codable misuse (UntaggedEnumTests #8)", .tags(.codable, .codedAt, .encoding, .enums, .errorHandling, .macroExpansion, .untagged)) func misuseInCombinationWithCodedAtMacro() throws { assertMacroExpansion( """ @@ -146,7 +146,7 @@ struct UntaggedEnumTests { ) } - @Test("Reports error for @Codable misuse (UntaggedEnumTests #9)") + @Test("Reports error for @Codable misuse (UntaggedEnumTests #9)", .tags(.codable, .encoding, .enums, .errorHandling, .macroExpansion, .untagged)) func duplicatedMisuse() throws { assertMacroExpansion( """ @@ -252,7 +252,7 @@ struct UntaggedEnumTests { case dictionary([String: Self]) } - @Test("Generates macro expansion with @Codable for enum (UntaggedEnumTests #28)") + @Test("Generates macro expansion with @Codable for enum (UntaggedEnumTests #28)", .tags(.codable, .encoding, .enums, .macroExpansion, .untagged)) func expansion() throws { assertMacroExpansion( """ @@ -375,7 +375,7 @@ struct UntaggedEnumTests { ) } - @Test("Encodes and decodes successfully (UntaggedEnumTests #36)") + @Test("Encodes and decodes successfully (UntaggedEnumTests #36)", .tags(.decoding, .encoding, .untagged)) func decodingAndEncodingBool() throws { let original: CodableValue = .bool(true) let encoded = try JSONEncoder().encode(original) @@ -388,7 +388,7 @@ struct UntaggedEnumTests { } } - @Test("Encodes and decodes successfully (UntaggedEnumTests #37)") + @Test("Encodes and decodes successfully (UntaggedEnumTests #37)", .tags(.decoding, .encoding, .untagged)) func decodingAndEncodingString() throws { let original: CodableValue = .string("test") let encoded = try JSONEncoder().encode(original) @@ -401,7 +401,7 @@ struct UntaggedEnumTests { } } - @Test("Decodes from JSON successfully (UntaggedEnumTests #98)") + @Test("Decodes from JSON successfully (UntaggedEnumTests #98)", .tags(.decoding, .untagged)) func decodingFromJSONPrimitives() throws { // Test bool let boolJson = "true".data(using: .utf8)! @@ -434,7 +434,7 @@ struct UntaggedEnumTests { } } - @Test("Decodes from JSON successfully (UntaggedEnumTests #99)") + @Test("Decodes from JSON successfully (UntaggedEnumTests #99)", .tags(.decoding, .untagged)) func decodingFromJSONArray() throws { let arrayJson = "[true, \"test\", 123]".data(using: .utf8)! let arrayDecoded = try JSONDecoder().decode( @@ -468,7 +468,7 @@ struct UntaggedEnumTests { case `nil` } - @Test("Generates macro expansion with @Codable for enum (UntaggedEnumTests #29)") + @Test("Generates macro expansion with @Codable for enum (UntaggedEnumTests #29)", .tags(.codable, .encoding, .enums, .macroExpansion, .untagged)) func expansion() throws { assertMacroExpansion( """ @@ -591,7 +591,7 @@ struct UntaggedEnumTests { ) } - @Test("Decodes from JSON successfully (UntaggedEnumTests #100)") + @Test("Decodes from JSON successfully (UntaggedEnumTests #100)", .tags(.decoding, .untagged)) func decoding() throws { let data = try JSONDecoder().decode( CodableValue.self, from: heterogenousJSONData @@ -617,7 +617,7 @@ struct UntaggedEnumTests { case multi(_ variable: Bool, val: Int, String) } - @Test("Generates macro expansion with @Codable for enum (UntaggedEnumTests #30)") + @Test("Generates macro expansion with @Codable for enum (UntaggedEnumTests #30)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .optionals, .untagged)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/VariableDeclarationTests.swift b/Tests/MetaCodableTests/VariableDeclarationTests.swift index 3cf3db1e4e..22e9d30ae5 100644 --- a/Tests/MetaCodableTests/VariableDeclarationTests.swift +++ b/Tests/MetaCodableTests/VariableDeclarationTests.swift @@ -14,7 +14,7 @@ struct VariableDeclarationTests { let value: String = "some" } - @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #101)") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #101)", .tags(.codable, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -54,7 +54,7 @@ struct VariableDeclarationTests { ) } - @Test("Encodes and decodes successfully (VariableDeclarationTests #38)") + @Test("Encodes and decodes successfully (VariableDeclarationTests #38)", .tags(.decoding, .encoding)) func decodingAndEncoding() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -63,7 +63,7 @@ struct VariableDeclarationTests { #expect(decoded.value == "some") } - @Test("Decodes from JSON successfully (VariableDeclarationTests #101)") + @Test("Decodes from JSON successfully (VariableDeclarationTests #101)", .tags(.decoding)) func decodingFromEmptyJSON() throws { let jsonStr = "{}" let jsonData = try #require(jsonStr.data(using: .utf8)) @@ -72,7 +72,7 @@ struct VariableDeclarationTests { #expect(decoded.value == "some") } - @Test("Encodes to JSON successfully (VariableDeclarationTests #24)") + @Test("Encodes to JSON successfully (VariableDeclarationTests #24)", .tags(.encoding, .optionals)) func encodingToJSON() throws { let original = SomeCodable() let encoded = try JSONEncoder().encode(original) @@ -91,7 +91,7 @@ struct VariableDeclarationTests { var value: String = "some" } - @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #102)") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #102)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -146,7 +146,7 @@ struct VariableDeclarationTests { var value: String { "some" } } - @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #103)") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #103)", .tags(.codable, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -189,7 +189,7 @@ struct VariableDeclarationTests { } } - @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #104)") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #104)", .tags(.codable, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -241,7 +241,7 @@ struct VariableDeclarationTests { } } - @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #105)") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #105)", .tags(.codable, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -296,7 +296,7 @@ struct VariableDeclarationTests { } } - @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #106)") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #106)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -376,7 +376,7 @@ struct VariableDeclarationTests { } } - @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #107)") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #107)", .tags(.codable, .decoding, .encoding, .enums, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -465,7 +465,7 @@ struct VariableDeclarationTests { } } - @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #108)") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #108)", .tags(.codable, .macroExpansion, .memberInit, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -518,7 +518,7 @@ struct VariableDeclarationTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #109)") + @Test("Generates macro expansion with @Codable for struct (VariableDeclarationTests #109)", .tags(.codable, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ @@ -610,7 +610,7 @@ struct VariableDeclarationTests { let value: String? } - @Test("Generates macro expansion with @Codable for struct with optional properties (VariableDeclarationTests #1)") + @Test("Generates macro expansion with @Codable for struct with optional properties (VariableDeclarationTests #1)", .tags(.codable, .enums, .macroExpansion, .memberInit, .optionals, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/TODO/CoverageTracking.md b/Tests/TODO/CoverageTracking.md index 3f3e2e8e83..97f1a19e5b 100644 --- a/Tests/TODO/CoverageTracking.md +++ b/Tests/TODO/CoverageTracking.md @@ -195,8 +195,8 @@ These are test helper types that don't need direct testing: ### Medium Priority -4. **DefaultSequenceElementCoding optional methods** -5. **DynamicCodableIdentifier+CodingKey.init(intValue:)** +1. **DefaultSequenceElementCoding optional methods** +2. **DynamicCodableIdentifier+CodingKey.init(intValue:)** ### Low Priority (skip with reason) @@ -221,6 +221,7 @@ These are test helper types that don't need direct testing: ## Test Organization Update (2026-01-30) All test files have been updated with: + - **@Suite declarations** for logical grouping - **Meaningful @Test names** based on actual test logic - **Unique test names** across all 565 tests in 50 files @@ -229,3 +230,28 @@ All test files have been updated with: Test names now clearly describe what each test verifies, making failures immediately understandable. +### Test Tagging System + +All 529 tests are tagged for easy filtering and organization using Swift Testing's tag system. Tags are defined in `Tests/MetaCodableTests/Tags.swift`. + +**Available Tags:** + +**Macro Tags:** `.codable`, `.codedAt`, `.codedIn`, `.codedBy`, `.codedAs`, `.codingKeys`, `.default`, `.ignoreCoding`, `.ignoreDecoding`, `.ignoreEncoding`, `.ignoreCodingInitialized`, `.contentAt`, `.untagged`, `.memberInit`, `.inherits` + +**Test Type Tags:** `.macroExpansion`, `.encoding`, `.decoding`, `.errorHandling`, `.integration` + +**Feature Tags:** `.helperCoders`, `.dynamicCoding`, `.inheritance`, `.generics`, `.accessModifiers`, `.optionals` + +**Type Tags:** `.enums`, `.structs`, `.classes`, `.rawRepresentable` + +**Helper Coder Tags:** `.dateCoder`, `.dataCoder`, `.sequenceCoder`, `.lossySequence`, `.valueCoder`, `.nonConformingCoder`, `.conditionalCoder` + +**Coverage Tags:** `.coverage` (for coverage-specific tests) + +**Example Usage:** +```swift +@Test("Generates @Codable conformance for struct with 'open' access", + .tags(.codable, .macroExpansion, .structs, .accessModifiers)) +func expansion() throws { ... } +``` + From b031947b9de77eaddde2ad9daaf81b86a432bbbb Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 16:07:44 +0700 Subject: [PATCH 17/29] style: format long @Test declarations as multiline for readability Added multiline formatting for @Test declarations with many tags: - Tests with many tags (>3) now use multiline format - Each tag on its own line for better readability - Applied to CodableTests and GenericsTests as examples - Format: @Test( "Test name", .tags( .tag1, .tag2, .tag3 ) ) All 565 tests continue to pass. --- Tests/MetaCodableTests/CodableTests.swift | 13 ++++++++++++- Tests/MetaCodableTests/GenericsTests.swift | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Tests/MetaCodableTests/CodableTests.swift b/Tests/MetaCodableTests/CodableTests.swift index 391be5a8cd..e35fd1c892 100644 --- a/Tests/MetaCodableTests/CodableTests.swift +++ b/Tests/MetaCodableTests/CodableTests.swift @@ -30,7 +30,18 @@ struct CodableTests { } } - @Test("Reports error for @Codable misuse (CodableTests #1)", .tags(.codable, .decoding, .encoding, .enums, .errorHandling, .macroExpansion, .structs)) + @Test( + "Reports error for @Codable misuse (CodableTests #1)", + .tags( + .codable, + .decoding, + .encoding, + .enums, + .errorHandling, + .macroExpansion, + .structs + ) + ) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/GenericsTests.swift b/Tests/MetaCodableTests/GenericsTests.swift index 53397864b0..a6cc42455e 100644 --- a/Tests/MetaCodableTests/GenericsTests.swift +++ b/Tests/MetaCodableTests/GenericsTests.swift @@ -13,7 +13,18 @@ struct GenericsTests { let value: T } - @Test("Generates @Codable conformance for struct (GenericsTests #7)", .tags(.codable, .decoding, .encoding, .enums, .generics, .macroExpansion, .structs)) + @Test( + "Generates @Codable conformance for struct (GenericsTests #7)", + .tags( + .codable, + .decoding, + .encoding, + .enums, + .generics, + .macroExpansion, + .structs + ) + ) func expansion() throws { assertMacroExpansion( """ From aa9002eb9ad139ff9b5ea5b0f9bbc8fa37a35f14 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 16:08:10 +0700 Subject: [PATCH 18/29] docs: fix markdown lint error - add blank line before code block --- Tests/TODO/CoverageTracking.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/TODO/CoverageTracking.md b/Tests/TODO/CoverageTracking.md index 97f1a19e5b..629380cf0d 100644 --- a/Tests/TODO/CoverageTracking.md +++ b/Tests/TODO/CoverageTracking.md @@ -249,6 +249,7 @@ All 529 tests are tagged for easy filtering and organization using Swift Testing **Coverage Tags:** `.coverage` (for coverage-specific tests) **Example Usage:** + ```swift @Test("Generates @Codable conformance for struct with 'open' access", .tags(.codable, .macroExpansion, .structs, .accessModifiers)) From bb8f9a5edb7afbdba1fe06e125100d1df4805ae7 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 16:21:30 +0700 Subject: [PATCH 19/29] fix: handle partial Bool coverage in TaggedEnumSwitcherVariable - Add tests for partial Bool coverage in CodedAsMixedTypesTests.swift - Fix decodeSwitchExpression to only skip default case when both true and false Bool values are covered - Previously, default case was skipped for ALL Bool switches, causing unreachable code warnings when only one Bool value was specified The fix checks if both true and false are present in the enum cases before deciding to skip the default case in Bool switches. --- .../Switcher/TaggedEnumSwitcherVariable.swift | 21 +- .../CodedAs/CodedAsMixedTypesTests.swift | 292 ++++++++++++++++++ 2 files changed, 312 insertions(+), 1 deletion(-) create mode 100644 Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift diff --git a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift index 3f4cea9b6a..dc1289a54b 100644 --- a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift +++ b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift @@ -40,6 +40,25 @@ extension TaggedEnumSwitcherVariable { preSyntax: (TokenSyntax) -> CodeBlockItemListSyntax ) -> SwitchExprSyntax? { var switchable = false + + // For Bool type, check if both true and false values are present + var hasBoolTrue = false + var hasBoolFalse = false + if header.type == .bool { + for (_, value) in location.cases { + let boolValues = value.decodeExprs.filter { $0.type == .bool } + for boolValue in boolValues { + let valueStr = boolValue.syntax.trimmedDescription + if valueStr == "true" { + hasBoolTrue = true + } else if valueStr == "false" { + hasBoolFalse = true + } + } + } + } + let skipDefaultForBool = header.type == .bool && hasBoolTrue && hasBoolFalse + let switchExpr = SwitchExprSyntax(subject: header.syntax) { for (`case`, value) in location.cases where `case`.decode ?? true { let values = value.decodeExprs @@ -62,7 +81,7 @@ extension TaggedEnumSwitcherVariable { } } - if `default` && header.type != .bool { + if `default` && !skipDefaultForBool { SwitchCaseSyntax(label: .default(.init())) { "break" } diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift new file mode 100644 index 0000000000..6215e0ad24 --- /dev/null +++ b/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift @@ -0,0 +1,292 @@ +import Foundation +import MetaCodable +import Testing + +@testable import PluginCore + +/// Tests for `@CodedAs` macro with mixed literal types including partial `Bool` coverage. +/// +/// These tests verify that internally tagged enums work correctly when `@CodedAs` +/// specifies multiple literal types (`String`, `Int`, `Bool`) and not all `enum` cases +/// have `Bool` values, resulting in partial `Bool` coverage in `switch` statements. +@Suite("CodedAs Mixed Types Tests") +struct CodedAsMixedTypesTests { + /// Tests macro expansion when `@CodedAs` includes `Bool` values + /// but not all cases have them. + /// + /// This scenario requires the generated `Bool` switch to include a `default` case + /// since only `true` is specified (for `load` case) and `false` is not covered. + @Test("Expansion with partial Bool coverage") + func expansionWithPartialBoolCoverage() throws { + assertMacroExpansion( + """ + @Codable + @CodedAt("type") + enum Command { + @CodedAs("load", 12, true) + case load(key: String) + @CodedAs("store", 30) + case store(key: String, value: Int) + } + """, + expandedSource: + """ + enum Command { + case load(key: String) + case store(key: String, value: Int) + } + + extension Command: Decodable { + init(from decoder: any Decoder) throws { + var typeContainer: KeyedDecodingContainer? + let container = try? decoder.container(keyedBy: CodingKeys.self) + if let container = container { + typeContainer = container + } else { + typeContainer = nil + } + if let typeContainer = typeContainer, let container = container { + let typeBool: Bool? + do { + typeBool = try typeContainer.decodeIfPresent(Bool.self, forKey: CodingKeys.type) ?? nil + } catch { + typeBool = nil + } + if let typeBool = typeBool { + switch typeBool { + case true: + let key: String + let container = try decoder.container(keyedBy: CodingKeys.self) + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + default: + break + } + } + let typeInt: Int? + do { + typeInt = try typeContainer.decodeIfPresent(Int.self, forKey: CodingKeys.type) ?? nil + } catch { + typeInt = nil + } + if let typeInt = typeInt { + switch typeInt { + case 12: + let key: String + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + case 30: + let key: String + let value: Int + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + let typeString: String? + do { + typeString = try typeContainer.decodeIfPresent(String.self, forKey: CodingKeys.type) ?? nil + } catch { + typeString = nil + } + if let typeString = typeString { + switch typeString { + case "load": + let key: String + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + case "store": + let key: String + let value: Int + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + } + let context = DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Couldn't match any cases." + ) + throw DecodingError.typeMismatch(Self.self, context) + } + } + + extension Command: Encodable { + func encode(to encoder: any Encoder) throws { + let container = encoder.container(keyedBy: CodingKeys.self) + var typeContainer = container + switch self { + case .load(key: let key): + try typeContainer.encode("load", forKey: CodingKeys.type) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(key, forKey: CodingKeys.key) + case .store(key: let key, value: let value): + try typeContainer.encode("store", forKey: CodingKeys.type) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(key, forKey: CodingKeys.key) + try container.encode(value, forKey: CodingKeys.value) + } + } + } + + extension Command { + enum CodingKeys: String, CodingKey { + case type = "type" + case key = "key" + case value = "value" + } + } + """ + ) + } + + /// Tests macro expansion when only `false` is specified for Bool type. + /// + /// Similar to the `true`-only case, this requires a `default` case since + /// `true` is not covered. + @Test("Expansion with only false Bool value") + func expansionWithOnlyFalseBoolValue() throws { + assertMacroExpansion( + """ + @Codable + @CodedAt("type") + enum Command { + @CodedAs("load", 12) + case load(key: String) + @CodedAs("store", 30, false) + case store(key: String, value: Int) + } + """, + expandedSource: + """ + enum Command { + case load(key: String) + case store(key: String, value: Int) + } + + extension Command: Decodable { + init(from decoder: any Decoder) throws { + var typeContainer: KeyedDecodingContainer? + let container = try? decoder.container(keyedBy: CodingKeys.self) + if let container = container { + typeContainer = container + } else { + typeContainer = nil + } + if let typeContainer = typeContainer, let container = container { + let typeBool: Bool? + do { + typeBool = try typeContainer.decodeIfPresent(Bool.self, forKey: CodingKeys.type) ?? nil + } catch { + typeBool = nil + } + if let typeBool = typeBool { + switch typeBool { + case false: + let key: String + let value: Int + let container = try decoder.container(keyedBy: CodingKeys.self) + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + let typeInt: Int? + do { + typeInt = try typeContainer.decodeIfPresent(Int.self, forKey: CodingKeys.type) ?? nil + } catch { + typeInt = nil + } + if let typeInt = typeInt { + switch typeInt { + case 12: + let key: String + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + case 30: + let key: String + let value: Int + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + let typeString: String? + do { + typeString = try typeContainer.decodeIfPresent(String.self, forKey: CodingKeys.type) ?? nil + } catch { + typeString = nil + } + if let typeString = typeString { + switch typeString { + case "load": + let key: String + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + case "store": + let key: String + let value: Int + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + } + let context = DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Couldn't match any cases." + ) + throw DecodingError.typeMismatch(Self.self, context) + } + } + + extension Command: Encodable { + func encode(to encoder: any Encoder) throws { + let container = encoder.container(keyedBy: CodingKeys.self) + var typeContainer = container + switch self { + case .load(key: let key): + try typeContainer.encode("load", forKey: CodingKeys.type) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(key, forKey: CodingKeys.key) + case .store(key: let key, value: let value): + try typeContainer.encode("store", forKey: CodingKeys.type) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(key, forKey: CodingKeys.key) + try container.encode(value, forKey: CodingKeys.value) + } + } + } + + extension Command { + enum CodingKeys: String, CodingKey { + case type = "type" + case key = "key" + case value = "value" + } + } + """ + ) + } +} From e6e5a1217a64b6465a109477f8191081551d855a Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 16:21:30 +0700 Subject: [PATCH 20/29] fix: handle partial Bool coverage in TaggedEnumSwitcherVariable - Add tests for partial Bool coverage in CodedAsMixedTypesTests.swift - Fix decodeSwitchExpression to only skip default case when both true and false Bool values are covered - Previously, default case was skipped for ALL Bool switches, causing unreachable code warnings when only one Bool value was specified The fix checks if both true and false are present in the enum cases before deciding to skip the default case in Bool switches. (cherry picked from commit bb8f9a5edb7afbdba1fe06e125100d1df4805ae7) --- .../Switcher/TaggedEnumSwitcherVariable.swift | 6 +- .../CodedAs/CodedAsMixedTypesTests.swift | 145 +++++++++++++++++- 2 files changed, 147 insertions(+), 4 deletions(-) diff --git a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift index 71a135995a..68eb12a510 100644 --- a/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift +++ b/Sources/PluginCore/Variables/Enum/Switcher/TaggedEnumSwitcherVariable.swift @@ -49,8 +49,8 @@ extension TaggedEnumSwitcherVariable { preSyntax: (TokenSyntax) -> CodeBlockItemListSyntax ) -> SwitchExprSyntax? { var switchable = false - - /// For `Bool` type, check if both `true` and `false` values are present + + // For Bool type, check if both true and false values are present var hasBoolTrue = false var hasBoolFalse = false if header.type == .bool { @@ -67,7 +67,7 @@ extension TaggedEnumSwitcherVariable { } } let skipDefaultForBool = header.type == .bool && hasBoolTrue && hasBoolFalse - + let switchExpr = SwitchExprSyntax(subject: header.syntax) { for (`case`, value) in location.cases where `case`.decode ?? true { let values = value.decodeExprs diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift index 0d19c75c95..00647e8493 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift @@ -12,7 +12,7 @@ import Testing @Suite("CodedAs Mixed Types Tests") struct CodedAsMixedTypesTests { /// Tests macro expansion when `@CodedAs` includes `Bool` values - /// but not all cases have them. + /// but not all cases have them. /// /// This scenario requires the generated `Bool` switch to include a `default` case /// since only `true` is specified (for `load` case) and `false` is not covered. @@ -149,4 +149,147 @@ struct CodedAsMixedTypesTests { """ ) } +<<<<<<< HEAD +======= + + /// Tests macro expansion when only `false` is specified for Bool type. + /// + /// Similar to the `true`-only case, this requires a `default` case since + /// `true` is not covered. + @Test("Expansion with only false Bool value") + func expansionWithOnlyFalseBoolValue() throws { + assertMacroExpansion( + """ + @Codable + @CodedAt("type") + enum Command { + @CodedAs("load", 12) + case load(key: String) + @CodedAs("store", 30, false) + case store(key: String, value: Int) + } + """, + expandedSource: + """ + enum Command { + case load(key: String) + case store(key: String, value: Int) + } + + extension Command: Decodable { + init(from decoder: any Decoder) throws { + var typeContainer: KeyedDecodingContainer? + let container = try? decoder.container(keyedBy: CodingKeys.self) + if let container = container { + typeContainer = container + } else { + typeContainer = nil + } + if let typeContainer = typeContainer, let container = container { + let typeBool: Bool? + do { + typeBool = try typeContainer.decodeIfPresent(Bool.self, forKey: CodingKeys.type) ?? nil + } catch { + typeBool = nil + } + if let typeBool = typeBool { + switch typeBool { + case false: + let key: String + let value: Int + let container = try decoder.container(keyedBy: CodingKeys.self) + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + let typeInt: Int? + do { + typeInt = try typeContainer.decodeIfPresent(Int.self, forKey: CodingKeys.type) ?? nil + } catch { + typeInt = nil + } + if let typeInt = typeInt { + switch typeInt { + case 12: + let key: String + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + case 30: + let key: String + let value: Int + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + let typeString: String? + do { + typeString = try typeContainer.decodeIfPresent(String.self, forKey: CodingKeys.type) ?? nil + } catch { + typeString = nil + } + if let typeString = typeString { + switch typeString { + case "load": + let key: String + key = try container.decode(String.self, forKey: CodingKeys.key) + self = .load(key: key) + return + case "store": + let key: String + let value: Int + key = try container.decode(String.self, forKey: CodingKeys.key) + value = try container.decode(Int.self, forKey: CodingKeys.value) + self = .store(key: key, value: value) + return + default: + break + } + } + } + let context = DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "Couldn't match any cases." + ) + throw DecodingError.typeMismatch(Self.self, context) + } + } + + extension Command: Encodable { + func encode(to encoder: any Encoder) throws { + let container = encoder.container(keyedBy: CodingKeys.self) + var typeContainer = container + switch self { + case .load(key: let key): + try typeContainer.encode("load", forKey: CodingKeys.type) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(key, forKey: CodingKeys.key) + case .store(key: let key, value: let value): + try typeContainer.encode("store", forKey: CodingKeys.type) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(key, forKey: CodingKeys.key) + try container.encode(value, forKey: CodingKeys.value) + } + } + } + + extension Command { + enum CodingKeys: String, CodingKey { + case type = "type" + case key = "key" + case value = "value" + } + } + """ + ) + } +>>>>>>> bb8f9a5ed (fix: handle partial Bool coverage in TaggedEnumSwitcherVariable) } From 161b144f952cb7b69005410a06907ea25ec4adca Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 16:43:35 +0700 Subject: [PATCH 21/29] fix: remove merge conflict markers from `CodedAsMixedTypesTests.swift` Remove leftover merge conflict markers (`<<<<<<< HEAD, =======, >>>>>>>`) from the test file that were accidentally committed during the previous merge. --- Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift b/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift index 00647e8493..6215e0ad24 100644 --- a/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift +++ b/Tests/MetaCodableTests/CodedAs/CodedAsMixedTypesTests.swift @@ -149,8 +149,6 @@ struct CodedAsMixedTypesTests { """ ) } -<<<<<<< HEAD -======= /// Tests macro expansion when only `false` is specified for Bool type. /// @@ -291,5 +289,4 @@ struct CodedAsMixedTypesTests { """ ) } ->>>>>>> bb8f9a5ed (fix: handle partial Bool coverage in TaggedEnumSwitcherVariable) } From 234408713733edf5bb81ab0f0ff0f07c2cafe867 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 17:10:35 +0700 Subject: [PATCH 22/29] Add Swift CI workflow for build and test automation --- .github/workflows/swift.yml | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/swift.yml diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 0000000000..9bbedc70bd --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,44 @@ +# This workflow will build a Swift project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift + +name: Swift setup, cache, build, test + +permissions: + contents: read + +on: + push: + branches: [ "main" ] + paths-ignore: + - '**/*.md' + pull_request: + paths-ignore: + - '**/*.md' + +jobs: + build-and-test: + runs-on: macos-latest + timeout-minutes: 20 + + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Set up Swift toolchain + uses: swift-actions/setup-swift@v2 + with: + swift-version: "6.2" + + - name: Cache SwiftPM dependencies + uses: actions/cache@v4 + with: + path: .build + key: ${{ runner.os }}-swiftpm-${{ hashFiles('Package.resolved') }} + restore-keys: | + ${{ runner.os }}-swiftpm- + + - name: Build + run: swift build --configuration debug + + - name: Run tests + run: swift test --configuration debug --parallel --verbose From fae5691e6ef296fbbb503d315ffedf846f0d3682 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 17:11:02 +0700 Subject: [PATCH 23/29] Disable main.yml workflow in favor of swift.yml --- .github/workflows/{main.yml => main.yml.disabled} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{main.yml => main.yml.disabled} (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml.disabled similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/main.yml.disabled From 1f3e57c2dd193f9d99e662e09546cb7adccc0fae Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 17:13:42 +0700 Subject: [PATCH 24/29] Re-enable `main.yml` workflow by removing the `.disabled` extension. This workflow will be disabled on GitHub. --- .github/workflows/{main.yml.disabled => main.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{main.yml.disabled => main.yml} (100%) diff --git a/.github/workflows/main.yml.disabled b/.github/workflows/main.yml similarity index 100% rename from .github/workflows/main.yml.disabled rename to .github/workflows/main.yml From 4e57d33b0d1f80ff9cb17ec7cd41dc1beaefc979 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 17:18:15 +0700 Subject: [PATCH 25/29] chore: simplify Swift workflow name to "Swift `build` & `test`" --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 9bbedc70bd..98b189645c 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -1,7 +1,7 @@ # This workflow will build a Swift project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift -name: Swift setup, cache, build, test +name: Swift `build` & `test` permissions: contents: read From 3ffa20e75014f20a9168fa487d4d74796d707af3 Mon Sep 17 00:00:00 2001 From: Serhii Date: Fri, 30 Jan 2026 17:20:03 +0700 Subject: [PATCH 26/29] Update `README.md` With another badge @qizh is interested in --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 121a3a5b92..b1a58b2add 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # MetaCodable +[![Swift `build` & `test`](https://github.com/qizh/MetaCodable/actions/workflows/swift.yml/badge.svg?branch=tests%2Fimprove%2Fcoverage%2F30-01-26)](https://github.com/qizh/MetaCodable/actions/workflows/swift.yml) [![API Docs](http://img.shields.io/badge/Read_the-docs-2196f3.svg)](https://swiftpackageindex.com/SwiftyLab/MetaCodable/documentation/metacodable) [![Swift Package Manager Compatible](https://img.shields.io/github/v/tag/SwiftyLab/MetaCodable?label=SPM&color=orange)](https://badge.fury.io/gh/SwiftyLab%2FMetaCodable) [![CocoaPods Compatible](https://img.shields.io/cocoapods/v/MetaCodable.svg?label=CocoaPods&color=C90005)](https://badge.fury.io/co/MetaCodable) From 6ca3eeaf268dbd58335f89f73cc0544f55534c84 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 17:37:13 +0700 Subject: [PATCH 27/29] Fix: Downgrade to Swift 6.1 to avoid compiler crash in macro expansion Swift 6.2.1 has a bug causing fatalError during ExpandSynthesizedMemberMacroRequest when processing @Codable macro on protocols (ExtPost in PostPage.swift) --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 98b189645c..2e391b0b94 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -27,7 +27,7 @@ jobs: - name: Set up Swift toolchain uses: swift-actions/setup-swift@v2 with: - swift-version: "6.2" + swift-version: "6.1" - name: Cache SwiftPM dependencies uses: actions/cache@v4 From c589543bbf29628650c936abd2d8bc03d6e2a774 Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 17:49:50 +0700 Subject: [PATCH 28/29] Fix: Use default Xcode toolchain instead of swift-actions/setup-swift Swift 6.1/6.2 from swift-actions has compiler crash during macro expansion. Default Xcode toolchain on macos-latest should be more stable. --- .github/workflows/swift.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 2e391b0b94..b52f2e7c2a 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -24,10 +24,8 @@ jobs: - name: Checkout uses: actions/checkout@v5 - - name: Set up Swift toolchain - uses: swift-actions/setup-swift@v2 - with: - swift-version: "6.1" + - name: Show Swift version + run: swift --version - name: Cache SwiftPM dependencies uses: actions/cache@v4 From 201ce15b0f9fd3660d7e196bb642ba5e2b90ab0f Mon Sep 17 00:00:00 2001 From: Serhii Shevchenko Date: Fri, 30 Jan 2026 20:15:21 +0700 Subject: [PATCH 29/29] Refactor test organization with nested suites and improve test descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - [x] Reorganize `ConditionalCoderTests`, `DefaultSequenceElementCodingTests`, and `DynamicCodableIdentifierTests` into nested test suites. - [x] Update test descriptions to be more concise and descriptive. - [x] Remove `CHANGELOG` entry about unreachable default case warnings (again 🤦🏻‍♂️). - [x] Simplify multi-line test attribute formatting in `CodableTests`. --- CHANGELOG.md | 1 - Tests/MetaCodableTests/CodableTests.swift | 13 +- .../ConditionalCoderTests.swift | 101 +++--- .../DefaultSequenceElementCodingTests.swift | 231 +++++++------ .../DynamicCodableIdentifierTests.swift | 173 +++++----- Tests/MetaCodableTests/GenericsTests.swift | 13 +- Tests/MetaCodableTests/HelperCoderTests.swift | 323 +++++++++--------- .../HelperCoders/LossySequenceTests.swift | 12 - Tests/MetaCodableTests/Tags.swift | 59 ++-- 9 files changed, 475 insertions(+), 451 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 935b8ba2ab..fcf058a2a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,6 @@ ### 🐛 Fixes * fixed optional types not detected with `valueCoder` strategy ([#141](https://github.com/SwiftyLab/MetaCodable/issues/141)) ([5873c3e](https://github.com/SwiftyLab/MetaCodable/commit/5873c3e33ab98e61c06304bfc2a2c93ab199d65d)) -* removed unreachable `default` case warnings for `Bool` type switches in macro-generated code ## [1.5.0](https://github.com/SwiftyLab/MetaCodable/compare/v1.4.0...v1.5.0) (2025-07-08) diff --git a/Tests/MetaCodableTests/CodableTests.swift b/Tests/MetaCodableTests/CodableTests.swift index e35fd1c892..391be5a8cd 100644 --- a/Tests/MetaCodableTests/CodableTests.swift +++ b/Tests/MetaCodableTests/CodableTests.swift @@ -30,18 +30,7 @@ struct CodableTests { } } - @Test( - "Reports error for @Codable misuse (CodableTests #1)", - .tags( - .codable, - .decoding, - .encoding, - .enums, - .errorHandling, - .macroExpansion, - .structs - ) - ) + @Test("Reports error for @Codable misuse (CodableTests #1)", .tags(.codable, .decoding, .encoding, .enums, .errorHandling, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/ConditionalCoderTests.swift b/Tests/MetaCodableTests/ConditionalCoderTests.swift index 2efe7a7083..64de70ddf9 100644 --- a/Tests/MetaCodableTests/ConditionalCoderTests.swift +++ b/Tests/MetaCodableTests/ConditionalCoderTests.swift @@ -10,6 +10,8 @@ import Testing @Suite("Conditional Coder Tests") struct ConditionalCoderTests { + // MARK: Prefix & Suffix + /// A decoder-only coder that prefixes decoded strings. struct PrefixDecoder: HelperCoder { let prefix: String @@ -36,6 +38,8 @@ struct ConditionalCoderTests { } } + // MARK: Wrappers + /// Wrapper for decoding tests. struct DecodingWrapper: Decodable { let value: String? @@ -76,57 +80,64 @@ struct ConditionalCoderTests { } } - // MARK: - decodeIfPresent Tests - - /// Tests that `decodeIfPresent` uses the decoder coder and returns value. - @Test("Decodes from JSON successfully (ConditionalCoderTests #34)", .tags(.conditionalCoder, .decoding)) - func decodeIfPresentReturnsValue() throws { - let json = #"{"value": "test"}"# - let data = json.data(using: .utf8)! - - let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) - #expect(result.value == "decoded:test") - } + // MARK: Decode if present - /// Tests that `decodeIfPresent` returns nil when value is null. - @Test("Decodes from JSON successfully (ConditionalCoderTests #35)", .tags(.conditionalCoder, .decoding)) - func decodeIfPresentReturnsNilForNull() throws { - let json = #"{"value": null}"# - let data = json.data(using: .utf8)! + @Suite("Coder Tests → Decode if Present") + struct DecodeIfPresentCoderTests { + /// Tests that `decodeIfPresent` uses the decoder coder and returns value. + @Test("Decodes from JSON successfully (ConditionalCoderTests #34)", .tags(.conditionalCoder, .decoding)) + func decodeIfPresentReturnsValue() throws { + let json = #"{"value": "test"}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == "decoded:test") + } - let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) - #expect(result.value == nil) - } - - /// Tests that `decodeIfPresent` returns nil when key is missing. - @Test("Decodes from JSON successfully (ConditionalCoderTests #36)", .tags(.conditionalCoder, .decoding)) - func decodeIfPresentReturnsNilForMissingKey() throws { - let json = #"{}"# - let data = json.data(using: .utf8)! + /// Tests that `decodeIfPresent` returns nil when value is null. + @Test("Decodes from JSON successfully (ConditionalCoderTests #35)", .tags(.conditionalCoder, .decoding)) + func decodeIfPresentReturnsNilForNull() throws { + let json = #"{"value": null}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == nil) + } - let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) - #expect(result.value == nil) + /// Tests that `decodeIfPresent` returns nil when key is missing. + @Test("Decodes from JSON successfully (ConditionalCoderTests #36)", .tags(.conditionalCoder, .decoding)) + func decodeIfPresentReturnsNilForMissingKey() throws { + let json = #"{}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == nil) + } } - // MARK: - encodeIfPresent Tests + // MARK: Encode if present - /// Tests that `encodeIfPresent` uses the encoder coder when value is present. - @Test("Encodes to JSON successfully (ConditionalCoderTests #7)", .tags(.conditionalCoder, .encoding)) - func encodeIfPresentEncodesValue() throws { - let wrapper = EncodingWrapper(value: "test") - let data = try JSONEncoder().encode(wrapper) - let json = String(data: data, encoding: .utf8)! - - #expect(json.contains("test:encoded")) - } - - /// Tests that `encodeIfPresent` skips encoding when value is nil. - @Test("Encodes to JSON successfully (ConditionalCoderTests #8)", .tags(.conditionalCoder, .encoding)) - func encodeIfPresentSkipsNil() throws { - let wrapper = EncodingWrapper(value: nil) - let data = try JSONEncoder().encode(wrapper) - let json = String(data: data, encoding: .utf8)! + @Suite("Coder Tests → Encode if Present") + struct EncodeIfPresentCoderTests { + /// Tests that `encodeIfPresent` uses the encoder coder + /// when value is present. + @Test("Encodes to JSON successfully (ConditionalCoderTests #7)", .tags(.conditionalCoder, .encoding)) + func encodeIfPresentEncodesValue() throws { + let wrapper = EncodingWrapper(value: "test") + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json.contains("test:encoded")) + } - #expect(json == "{}") + /// Tests that `encodeIfPresent` skips encoding when value is nil. + @Test("Encodes to JSON successfully (ConditionalCoderTests #8)", .tags(.conditionalCoder, .encoding)) + func encodeIfPresentSkipsNil() throws { + let wrapper = EncodingWrapper(value: nil) + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json == "{}") + } } } diff --git a/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift index c83b508c00..83065e3ef7 100644 --- a/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift +++ b/Tests/MetaCodableTests/DefaultSequenceElementCodingTests.swift @@ -41,137 +41,154 @@ struct DefaultSequenceElementCodingTests { } } - // MARK: - decodeIfPresent(from:) Tests + // MARK: decodeIfPresent(from:) - /// Tests that `decodeIfPresent(from:)` returns value from single value container. - @Test("Decodes struct from JSON successfully", .tags(.coverage, .decoding, .default, .optionals, .structs)) - func decodeIfPresentFromDecoderReturnsValue() throws { - let json = #""test""# - let data = json.data(using: .utf8)! - - struct SingleValueWrapper: Decodable { - let value: String? + @Suite("Decode if present from decoder") + struct DecodeIfPresentFromDecoderTests { + + /// Tests that `decodeIfPresent(from:)` returns value + /// from single value container. + @Test("Decodes single value struct from JSON successfully", .tags(.coverage, .decoding, .default, .optionals, .structs)) + func decodeIfPresentFromDecoderReturnsValue() throws { + let json = #""test""# + let data = json.data(using: .utf8)! - init(from decoder: Decoder) throws { - let coder = DefaultSequenceElementCoding() - self.value = try coder.decodeIfPresent(from: decoder) + struct SingleValueWrapper: Decodable { + let value: String? + + init(from decoder: Decoder) throws { + let coder = DefaultSequenceElementCoding() + self.value = try coder.decodeIfPresent(from: decoder) + } } + + let result = try JSONDecoder().decode(SingleValueWrapper.self, from: data) + #expect(result.value == "test") } - let result = try JSONDecoder().decode(SingleValueWrapper.self, from: data) - #expect(result.value == "test") - } - - /// Tests that `decodeIfPresent(from:)` returns nil for null. - @Test("Decodes struct from JSON successfully (DefaultSequenceElementCodingTests #1)", .tags(.coverage, .decoding, .default, .optionals, .structs)) - func decodeIfPresentFromDecoderReturnsNilForNull() throws { - let json = #"null"# - let data = json.data(using: .utf8)! - - struct SingleValueWrapper: Decodable { - let value: String? + /// Tests that `decodeIfPresent(from:)` returns nil for null. + @Test("Decodes nil for null from JSON successfully", .tags(.coverage, .decoding, .default, .optionals, .structs)) + func decodeIfPresentFromDecoderReturnsNilForNull() throws { + let json = #"null"# + let data = json.data(using: .utf8)! - init(from decoder: Decoder) throws { - let coder = DefaultSequenceElementCoding() - self.value = try coder.decodeIfPresent(from: decoder) + struct SingleValueWrapper: Decodable { + let value: String? + + init(from decoder: Decoder) throws { + let coder = DefaultSequenceElementCoding() + self.value = try coder.decodeIfPresent(from: decoder) + } } + + let result = try JSONDecoder().decode(SingleValueWrapper.self, from: data) + #expect(result.value == nil) } - - let result = try JSONDecoder().decode(SingleValueWrapper.self, from: data) - #expect(result.value == nil) } - // MARK: - decodeIfPresent(from:forKey:) Tests - - /// Tests that `decodeIfPresent(from:forKey:)` returns value when present. - @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #41)", .tags(.coverage, .decoding, .default)) - func decodeIfPresentFromKeyedContainerReturnsValue() throws { - let json = #"{"value": "test"}"# - let data = json.data(using: .utf8)! - - let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) - #expect(result.value == "test") - } + // MARK: decodeIfPresent(from:forKey:) - /// Tests that `decodeIfPresent(from:forKey:)` returns nil for null. - @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #42)", .tags(.coverage, .decoding, .default)) - func decodeIfPresentFromKeyedContainerReturnsNilForNull() throws { - let json = #"{"value": null}"# - let data = json.data(using: .utf8)! + @Suite("Decode if present from decoder for keyed container") + struct DecodeIfPresentFromDecoderForKeyedContainerTests { + + /// Tests that `decodeIfPresent(from:forKey:)` returns value when present. + @Test("Decodes from JSON successfully", .tags(.coverage, .decoding, .default)) + func decodeIfPresentFromKeyedContainerReturnsValue() throws { + let json = #"{"value": "test"}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == "test") + } - let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) - #expect(result.value == nil) - } - - /// Tests that `decodeIfPresent(from:forKey:)` returns nil for missing key. - @Test("Decodes from JSON successfully (DefaultSequenceElementCodingTests #43)", .tags(.coverage, .decoding, .default)) - func decodeIfPresentFromKeyedContainerReturnsNilForMissingKey() throws { - let json = #"{}"# - let data = json.data(using: .utf8)! + /// Tests that `decodeIfPresent(from:forKey:)` returns nil for null. + @Test("Decodes nil for null value from JSON successfully", .tags(.coverage, .decoding, .default)) + func decodeIfPresentFromKeyedContainerReturnsNilForNull() throws { + let json = #"{"value": null}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == nil) + } - let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) - #expect(result.value == nil) + /// Tests that `decodeIfPresent(from:forKey:)` returns nil for missing key. + @Test("Decodes from empty JSON successfully", .tags(.coverage, .decoding, .default)) + func decodeIfPresentFromKeyedContainerReturnsNilForMissingKey() throws { + let json = #"{}"# + let data = json.data(using: .utf8)! + + let result = try JSONDecoder().decode(DecodingWrapper.self, from: data) + #expect(result.value == nil) + } } - // MARK: - encodeIfPresent(_:to:) Tests + // MARK: encodeIfPresent(_:to:) - /// Tests that `encodeIfPresent(_:to:)` encodes value when present. - @Test("Encodes struct to JSON successfully", .tags(.coverage, .default, .encoding, .optionals, .structs)) - func encodeIfPresentToEncoderEncodesValue() throws { - struct SingleValueWrapper: Encodable { - let value: String? - - func encode(to encoder: Encoder) throws { - let coder = DefaultSequenceElementCoding() - try coder.encodeIfPresent(value, to: encoder) + @Suite("Encode to Encoder if value present") + struct EncodeToEncoderIfValuePresentTests { + + /// Tests that `encodeIfPresent(_:to:)` encodes value when present. + @Test("Encodes struct with value to JSON successfully", .tags(.coverage, .default, .encoding, .optionals, .structs)) + func encodeIfPresentToEncoderEncodesValue() throws { + struct SingleValueWrapper: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + let coder = DefaultSequenceElementCoding() + try coder.encodeIfPresent(value, to: encoder) + } } + + let wrapper = SingleValueWrapper(value: "test") + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json == #""test""#) } - let wrapper = SingleValueWrapper(value: "test") - let data = try JSONEncoder().encode(wrapper) - let json = String(data: data, encoding: .utf8)! - - #expect(json == #""test""#) - } - - /// Tests that `encodeIfPresent(_:to:)` encodes null for nil. - @Test("Encodes struct to JSON successfully (DefaultSequenceElementCodingTests #1)", .tags(.coverage, .default, .encoding, .optionals, .structs)) - func encodeIfPresentToEncoderEncodesNullForNil() throws { - struct SingleValueWrapper: Encodable { - let value: String? - - func encode(to encoder: Encoder) throws { - let coder = DefaultSequenceElementCoding() - try coder.encodeIfPresent(value, to: encoder) + /// Tests that `encodeIfPresent(_:to:)` encodes null for nil. + @Test("Encodes null for nil to JSON successfully", .tags(.coverage, .default, .encoding, .optionals, .structs)) + func encodeIfPresentToEncoderEncodesNullForNil() throws { + struct SingleValueWrapper: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + let coder = DefaultSequenceElementCoding() + try coder.encodeIfPresent(value, to: encoder) + } } + + let wrapper = SingleValueWrapper(value: nil) + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json == "null") } - - let wrapper = SingleValueWrapper(value: nil) - let data = try JSONEncoder().encode(wrapper) - let json = String(data: data, encoding: .utf8)! - - #expect(json == "null") } - // MARK: - encodeIfPresent(_:to:atKey:) Tests - - /// Tests that `encodeIfPresent(_:to:atKey:)` encodes value when present. - @Test("Encodes to JSON successfully (DefaultSequenceElementCodingTests #12)", .tags(.coverage, .default, .encoding)) - func encodeIfPresentToKeyedContainerEncodesValue() throws { - let wrapper = EncodingWrapper(value: "test") - let data = try JSONEncoder().encode(wrapper) - let json = String(data: data, encoding: .utf8)! - - #expect(json.contains("test")) - } + // MARK: encodeIfPresent(_:to:atKey:) - /// Tests that `encodeIfPresent(_:to:atKey:)` skips encoding for nil. - @Test("Encodes to JSON successfully (DefaultSequenceElementCodingTests #13)", .tags(.coverage, .default, .encoding)) - func encodeIfPresentToKeyedContainerSkipsNil() throws { - let wrapper = EncodingWrapper(value: nil) - let data = try JSONEncoder().encode(wrapper) - let json = String(data: data, encoding: .utf8)! + @Suite("Encode to Encoder if value present for keyed container") + struct EncodeToEncoderIfValuePresentForKeyedContainerTests { + + /// Tests that `encodeIfPresent(_:to:atKey:)` encodes value when present. + @Test("Encodes value to JSON successfully", .tags(.coverage, .default, .encoding)) + func encodeIfPresentToKeyedContainerEncodesValue() throws { + let wrapper = EncodingWrapper(value: "test") + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json.contains("test")) + } - #expect(json == "{}") + /// Tests that `encodeIfPresent(_:to:atKey:)` skips encoding for nil. + @Test("Skips nil encoding to JSON successfully", .tags(.coverage, .default, .encoding)) + func encodeIfPresentToKeyedContainerSkipsNil() throws { + let wrapper = EncodingWrapper(value: nil) + let data = try JSONEncoder().encode(wrapper) + let json = String(data: data, encoding: .utf8)! + + #expect(json == "{}") + } } } diff --git a/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift index 0e5786d715..16a7619449 100644 --- a/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift +++ b/Tests/MetaCodableTests/DynamicCodableIdentifierTests.swift @@ -9,103 +9,118 @@ import Testing @Suite("Dynamic Codable Identifier Tests") struct DynamicCodableIdentifierTests { - // MARK: - init(intValue:) Tests + // MARK: init(intValue:) - /// Tests that `init(intValue:)` always returns nil. - /// - /// DynamicCodableIdentifier uses string-based keys only, - /// so integer initialization is not supported. - @Test("Tests init int value returns nil", .tags(.coverage, .dynamicCoding)) - func initIntValueReturnsNil() { - let identifier = DynamicCodableIdentifier(intValue: 0) - #expect(identifier == nil) + @Suite("Init with Int values Tests") + struct InitWithIntValuesTests { - let identifier2 = DynamicCodableIdentifier(intValue: 42) - #expect(identifier2 == nil) + /// Tests that `init(intValue:)` always returns nil. + /// + /// DynamicCodableIdentifier uses string-based keys only, + /// so integer initialization is not supported. + @Test("Tests init int value returns nil", .tags(.coverage, .dynamicCoding)) + func initIntValueReturnsNil() { + let identifier = DynamicCodableIdentifier(intValue: 0) + #expect(identifier == nil) + + let identifier2 = DynamicCodableIdentifier(intValue: 42) + #expect(identifier2 == nil) + + let identifier3 = DynamicCodableIdentifier(intValue: -1) + #expect(identifier3 == nil) + } - let identifier3 = DynamicCodableIdentifier(intValue: -1) - #expect(identifier3 == nil) + /// Tests that `intValue` property always returns nil. + @Test("Tests int value property returns nil", .tags(.coverage, .dynamicCoding)) + func intValuePropertyReturnsNil() { + let identifier: DynamicCodableIdentifier = .one("test") + #expect(identifier.intValue == nil) + + let multiIdentifier: DynamicCodableIdentifier = .many(["a", "b"]) + #expect(multiIdentifier.intValue == nil) + } } - /// Tests that `intValue` property always returns nil. - @Test("Tests int value property returns nil", .tags(.coverage, .dynamicCoding)) - func intValuePropertyReturnsNil() { - let identifier: DynamicCodableIdentifier = .one("test") - #expect(identifier.intValue == nil) + // MARK: init(stringValue:) - let multiIdentifier: DynamicCodableIdentifier = .many(["a", "b"]) - #expect(multiIdentifier.intValue == nil) - } - - // MARK: - init(stringValue:) Tests - + @Suite("Init with String values Tests") + struct InitWithStringValuesTests { /// Tests that `init(stringValue:)` creates a single identifier. - @Test("Tests init string value creates single identifier", .tags(.coverage, .dynamicCoding, .optionals)) - func initStringValueCreatesSingleIdentifier() { - let identifier = DynamicCodableIdentifier(stringValue: "test") - #expect(identifier != nil) - #expect(identifier?.stringValue == "test") - } - - // MARK: - stringValue Tests - - /// Tests that `stringValue` returns the value for single identifier. - @Test("Tests string value returns single value", .tags(.coverage, .dynamicCoding)) - func stringValueReturnsSingleValue() { - let identifier: DynamicCodableIdentifier = .one("myKey") - #expect(identifier.stringValue == "myKey") - } - - /// Tests that `stringValue` returns first value for multiple identifiers. - @Test("Tests string value returns first value", .tags(.coverage, .dynamicCoding)) - func stringValueReturnsFirstValue() { - let identifier: DynamicCodableIdentifier = .many(["first", "second", "third"]) - #expect(identifier.stringValue == "first") - } - - /// Tests that `stringValue` returns empty string for empty multiple identifiers. - @Test("Tests string value returns empty for empty array", .tags(.coverage, .dynamicCoding)) - func stringValueReturnsEmptyForEmptyArray() { - let identifier: DynamicCodableIdentifier = .many([]) - #expect(identifier.stringValue == "") + @Test("Tests init string value creates single identifier", .tags(.coverage, .dynamicCoding, .optionals)) + func initStringValueCreatesSingleIdentifier() { + let identifier = DynamicCodableIdentifier(stringValue: "test") + #expect(identifier != nil) + #expect(identifier?.stringValue == "test") + } } - // MARK: - Pattern Matching Tests + // MARK: stringValue - /// Tests pattern matching with single identifier. - @Test("Tests pattern matching single identifier", .tags(.coverage, .dynamicCoding, .optionals, .structs)) - func patternMatchingSingleIdentifier() { - let identifier: DynamicCodableIdentifier = .one("type") + @Suite("Returning String values Tests") + struct ReturningStringValuesTests { - struct TestKey: CodingKey { - var stringValue: String - var intValue: Int? { nil } - init?(stringValue: String) { self.stringValue = stringValue } - init?(intValue: Int) { nil } + /// Tests that `stringValue` returns the value for single identifier. + @Test("Tests string value returns single value", .tags(.coverage, .dynamicCoding)) + func stringValueReturnsSingleValue() { + let identifier: DynamicCodableIdentifier = .one("myKey") + #expect(identifier.stringValue == "myKey") } - let key = TestKey(stringValue: "type")! - #expect(identifier ~= key) + /// Tests that `stringValue` returns first value for multiple identifiers. + @Test("Tests string value returns first value", .tags(.coverage, .dynamicCoding)) + func stringValueReturnsFirstValue() { + let identifier: DynamicCodableIdentifier = .many(["first", "second", "third"]) + #expect(identifier.stringValue == "first") + } - let otherKey = TestKey(stringValue: "other")! - #expect(!(identifier ~= otherKey)) + /// Tests that `stringValue` returns empty string for empty multiple identifiers. + @Test("Tests string value returns empty for empty array", .tags(.coverage, .dynamicCoding)) + func stringValueReturnsEmptyForEmptyArray() { + let identifier: DynamicCodableIdentifier = .many([]) + #expect(identifier.stringValue == "") + } } - /// Tests pattern matching with multiple identifiers. - @Test("Tests pattern matching multiple identifiers", .tags(.coverage, .dynamicCoding, .optionals, .structs)) - func patternMatchingMultipleIdentifiers() { - let identifier: DynamicCodableIdentifier = .many(["type", "kind", "category"]) + // MARK: Pattern Matching Tests + + @Suite("Pattern Matching Tests") + struct PatternMatchingTests { - struct TestKey: CodingKey { - var stringValue: String - var intValue: Int? { nil } - init?(stringValue: String) { self.stringValue = stringValue } - init?(intValue: Int) { nil } + /// Tests pattern matching with single identifier. + @Test("Tests pattern matching single identifier", .tags(.coverage, .dynamicCoding, .optionals, .structs)) + func patternMatchingSingleIdentifier() { + let identifier: DynamicCodableIdentifier = .one("type") + + struct TestKey: CodingKey { + var stringValue: String + var intValue: Int? { nil } + init?(stringValue: String) { self.stringValue = stringValue } + init?(intValue: Int) { nil } + } + + let key = TestKey(stringValue: "type")! + #expect(identifier ~= key) + + let otherKey = TestKey(stringValue: "other")! + #expect(!(identifier ~= otherKey)) } - #expect(identifier ~= TestKey(stringValue: "type")!) - #expect(identifier ~= TestKey(stringValue: "kind")!) - #expect(identifier ~= TestKey(stringValue: "category")!) - #expect(!(identifier ~= TestKey(stringValue: "other")!)) + /// Tests pattern matching with multiple identifiers. + @Test("Tests pattern matching multiple identifiers", .tags(.coverage, .dynamicCoding, .optionals, .structs)) + func patternMatchingMultipleIdentifiers() { + let identifier: DynamicCodableIdentifier = .many(["type", "kind", "category"]) + + struct TestKey: CodingKey { + var stringValue: String + var intValue: Int? { nil } + init?(stringValue: String) { self.stringValue = stringValue } + init?(intValue: Int) { nil } + } + + #expect(identifier ~= TestKey(stringValue: "type")!) + #expect(identifier ~= TestKey(stringValue: "kind")!) + #expect(identifier ~= TestKey(stringValue: "category")!) + #expect(!(identifier ~= TestKey(stringValue: "other")!)) + } } } diff --git a/Tests/MetaCodableTests/GenericsTests.swift b/Tests/MetaCodableTests/GenericsTests.swift index a6cc42455e..53397864b0 100644 --- a/Tests/MetaCodableTests/GenericsTests.swift +++ b/Tests/MetaCodableTests/GenericsTests.swift @@ -13,18 +13,7 @@ struct GenericsTests { let value: T } - @Test( - "Generates @Codable conformance for struct (GenericsTests #7)", - .tags( - .codable, - .decoding, - .encoding, - .enums, - .generics, - .macroExpansion, - .structs - ) - ) + @Test("Generates @Codable conformance for struct (GenericsTests #7)", .tags(.codable, .decoding, .encoding, .enums, .generics, .macroExpansion, .structs)) func expansion() throws { assertMacroExpansion( """ diff --git a/Tests/MetaCodableTests/HelperCoderTests.swift b/Tests/MetaCodableTests/HelperCoderTests.swift index 70df1e8595..e4a4a84b5d 100644 --- a/Tests/MetaCodableTests/HelperCoderTests.swift +++ b/Tests/MetaCodableTests/HelperCoderTests.swift @@ -31,196 +31,209 @@ struct HelperCoderTests { } } - // MARK: - decodeIfPresent Tests + // MARK: decodeIfPresent - /// Tests that `decodeIfPresent` returns a value when valid data is present. - @Test("Decodes struct from JSON successfully (HelperCoderTests #2)", .tags(.decoding, .enums, .helperCoders, .optionals, .structs)) - func decodeIfPresentWithValidData() throws { - let json = #"{"value": "test"}"# - let data = json.data(using: .utf8)! - let decoder = JSONDecoder() + @Suite("Decode if Present Tests with Helper Coders") + struct DecodeIfPresentTestsWithHelperCoders { - struct Container: Decodable { - let value: String + /// Tests that `decodeIfPresent` returns a value when valid data is present. + @Test("Decodes struct from JSON successfully (HelperCoderTests #2)", .tags(.decoding, .enums, .helperCoders, .optionals, .structs)) + func decodeIfPresentWithValidData() throws { + let json = #"{"value": "test"}"# + let data = json.data(using: .utf8)! + let decoder = JSONDecoder() - init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - let coder = StringWrapperCoder() - self.value = try coder.decodeIfPresent( - from: container, - forKey: .value - ) ?? "default" + struct Container: Decodable { + let value: String + + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + self.value = try coder.decodeIfPresent( + from: container, + forKey: .value + ) ?? "default" + } + + enum CodingKeys: String, CodingKey { + case value + } } - enum CodingKeys: String, CodingKey { - case value - } + let result = try decoder.decode(Container.self, from: data) + #expect(result.value == "wrapped:test") } - let result = try decoder.decode(Container.self, from: data) - #expect(result.value == "wrapped:test") - } - - /// Tests that `decodeIfPresent` returns nil when data is null. - @Test("Decodes struct from JSON successfully (HelperCoderTests #3)", .tags(.decoding, .enums, .helperCoders, .optionals, .structs)) - func decodeIfPresentWithNullData() throws { - let json = #"{"value": null}"# - let data = json.data(using: .utf8)! - let decoder = JSONDecoder() - - struct Container: Decodable { - let value: String? + /// Tests that `decodeIfPresent` returns nil when data is null. + @Test("Decodes struct from JSON successfully (HelperCoderTests #3)", .tags(.decoding, .enums, .helperCoders, .optionals, .structs)) + func decodeIfPresentWithNullData() throws { + let json = #"{"value": null}"# + let data = json.data(using: .utf8)! + let decoder = JSONDecoder() - init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - let coder = StringWrapperCoder() - self.value = try coder.decodeIfPresent( - from: container, - forKey: .value - ) + struct Container: Decodable { + let value: String? + + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + self.value = try coder.decodeIfPresent( + from: container, + forKey: .value + ) + } + + enum CodingKeys: String, CodingKey { + case value + } } - enum CodingKeys: String, CodingKey { - case value - } + let result = try decoder.decode(Container.self, from: data) + #expect(result.value == nil) } - let result = try decoder.decode(Container.self, from: data) - #expect(result.value == nil) - } - - /// Tests that `decodeIfPresent` returns nil when key is missing. - @Test("Decodes struct from JSON successfully (HelperCoderTests #4)", .tags(.decoding, .enums, .helperCoders, .optionals, .structs)) - func decodeIfPresentWithMissingKey() throws { - let json = #"{}"# - let data = json.data(using: .utf8)! - let decoder = JSONDecoder() - - struct Container: Decodable { - let value: String? + /// Tests that `decodeIfPresent` returns nil when key is missing. + @Test("Decodes struct from JSON successfully (HelperCoderTests #4)", .tags(.decoding, .enums, .helperCoders, .optionals, .structs)) + func decodeIfPresentWithMissingKey() throws { + let json = #"{}"# + let data = json.data(using: .utf8)! + let decoder = JSONDecoder() - init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - let coder = StringWrapperCoder() - self.value = try coder.decodeIfPresent( - from: container, - forKey: .value - ) + struct Container: Decodable { + let value: String? + + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + self.value = try coder.decodeIfPresent( + from: container, + forKey: .value + ) + } + + enum CodingKeys: String, CodingKey { + case value + } } - enum CodingKeys: String, CodingKey { - case value - } + let result = try decoder.decode(Container.self, from: data) + #expect(result.value == nil) } - - let result = try decoder.decode(Container.self, from: data) - #expect(result.value == nil) } - // MARK: - encode Tests + // MARK: Encode - /// Tests that `encode` works for Encodable types. - @Test("Encodes struct to JSON successfully (HelperCoderTests #2)", .tags(.encoding, .enums, .helperCoders, .structs)) - func encodeEncodableType() throws { - struct Container: Encodable { - let value: String - - func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - let coder = StringWrapperCoder() - try coder.encode(value, to: &container, atKey: .value) + @Suite("Encode Tests") + struct EncodeTests { + + /// Tests that `encode` works for Encodable types. + @Test("Encodes struct to JSON successfully (HelperCoderTests #2)", .tags(.encoding, .enums, .helperCoders, .structs)) + func encodeEncodableType() throws { + struct Container: Encodable { + let value: String + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + try coder.encode(value, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } } - enum CodingKeys: String, CodingKey { - case value - } + let container = Container(value: "test") + let encoder = JSONEncoder() + let data = try encoder.encode(container) + let json = String(data: data, encoding: .utf8)! + + #expect(json.contains("test")) } - let container = Container(value: "test") - let encoder = JSONEncoder() - let data = try encoder.encode(container) - let json = String(data: data, encoding: .utf8)! - - #expect(json.contains("test")) - } - - /// Tests that `encode` does nothing for non-Encodable types (default implementation). - @Test("Encodes struct to JSON successfully (HelperCoderTests #3)", .tags(.encoding, .enums, .helperCoders, .structs)) - func encodeNonEncodableType() throws { - struct Container: Encodable { - let nonEncodable: NonEncodableValue - - func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - let coder = NonEncodableCoder() - // This should not throw, just do nothing - try coder.encode(nonEncodable, to: &container, atKey: .value) + /// Tests that `encode` does nothing for non-Encodable types + /// (default implementation). + @Test("Encodes struct to JSON successfully (HelperCoderTests #3)", .tags(.encoding, .enums, .helperCoders, .structs)) + func encodeNonEncodableType() throws { + struct Container: Encodable { + let nonEncodable: NonEncodableValue + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = NonEncodableCoder() + // This should not throw, just do nothing + try coder.encode(nonEncodable, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } } - enum CodingKeys: String, CodingKey { - case value - } + let container = Container(nonEncodable: NonEncodableValue(value: 42)) + let encoder = JSONEncoder() + let data = try encoder.encode(container) + let json = String(data: data, encoding: .utf8)! + + /// The non-encodable value should not appear in the output + #expect(!json.contains("42")) } - - let container = Container(nonEncodable: NonEncodableValue(value: 42)) - let encoder = JSONEncoder() - let data = try encoder.encode(container) - let json = String(data: data, encoding: .utf8)! - - // The non-encodable value should not appear in the output - #expect(!json.contains("42")) } - // MARK: - encodeIfPresent Tests + // MARK: encodeIfPresent - /// Tests that `encodeIfPresent` encodes when value is present. - @Test("Encodes struct to JSON successfully (HelperCoderTests #4)", .tags(.encoding, .enums, .helperCoders, .optionals, .structs)) - func encodeIfPresentWithValue() throws { - struct Container: Encodable { - let value: String? - - func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - let coder = StringWrapperCoder() - try coder.encodeIfPresent(value, to: &container, atKey: .value) + @Suite("Encode if Present Tests") + struct EncodeIfPresentTests { + + /// Tests that `encodeIfPresent` encodes when value is present. + @Test("Encodes struct to JSON successfully (HelperCoderTests #4)", .tags(.encoding, .enums, .helperCoders, .optionals, .structs)) + func encodeIfPresentWithValue() throws { + struct Container: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + try coder.encodeIfPresent(value, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } } - enum CodingKeys: String, CodingKey { - case value - } + let container = Container(value: "test") + let encoder = JSONEncoder() + let data = try encoder.encode(container) + let json = String(data: data, encoding: .utf8)! + + #expect(json.contains("test")) } - let container = Container(value: "test") - let encoder = JSONEncoder() - let data = try encoder.encode(container) - let json = String(data: data, encoding: .utf8)! - - #expect(json.contains("test")) - } - - /// Tests that `encodeIfPresent` skips encoding when value is nil. - @Test("Encodes struct to JSON successfully (HelperCoderTests #5)", .tags(.encoding, .enums, .helperCoders, .optionals, .structs)) - func encodeIfPresentWithNil() throws { - struct Container: Encodable { - let value: String? - - func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - let coder = StringWrapperCoder() - try coder.encodeIfPresent(value, to: &container, atKey: .value) + /// Tests that `encodeIfPresent` skips encoding when value is nil. + @Test("Encodes struct to JSON successfully (HelperCoderTests #5)", .tags(.encoding, .enums, .helperCoders, .optionals, .structs)) + func encodeIfPresentWithNil() throws { + struct Container: Encodable { + let value: String? + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + let coder = StringWrapperCoder() + try coder.encodeIfPresent(value, to: &container, atKey: .value) + } + + enum CodingKeys: String, CodingKey { + case value + } } - enum CodingKeys: String, CodingKey { - case value - } + let container = Container(value: nil) + let encoder = JSONEncoder() + let data = try encoder.encode(container) + let json = String(data: data, encoding: .utf8)! + + /// Should be empty object since nil values are skipped + #expect(json == "{}") } - - let container = Container(value: nil) - let encoder = JSONEncoder() - let data = try encoder.encode(container) - let json = String(data: data, encoding: .utf8)! - - // Should be empty object since nil values are skipped - #expect(json == "{}") } } diff --git a/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift b/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift index af34a9c17e..c2d819cf01 100644 --- a/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift +++ b/Tests/MetaCodableTests/HelperCoders/LossySequenceTests.swift @@ -4,7 +4,6 @@ import Testing @Suite("Lossy Sequence Tests") struct LossySequenceTests { - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Decodes from JSON successfully (LossySequenceTests #57)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func invalidDataType() throws { @@ -14,7 +13,6 @@ struct LossySequenceTests { } } - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Decodes from JSON successfully (LossySequenceTests #58)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func emptyData() throws { @@ -23,7 +21,6 @@ struct LossySequenceTests { #expect(val.data == []) } - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Encodes and decodes successfully (LossySequenceTests #22)", .tags(.decoding, .encoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func validData() throws { @@ -34,7 +31,6 @@ struct LossySequenceTests { #expect(data == json) } - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Decodes from JSON successfully (LossySequenceTests #59)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func invalidData() throws { @@ -43,7 +39,6 @@ struct LossySequenceTests { #expect(val.data == ["1", "2"]) } - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Decodes from JSON successfully (LossySequenceTests #60)", .tags(.decoding, .lossySequence, .optionals)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalInvalidDataType() throws { @@ -55,7 +50,6 @@ struct LossySequenceTests { } } - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Decodes from JSON successfully (LossySequenceTests #61)", .tags(.decoding, .lossySequence, .optionals)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalEmptyData() throws { @@ -64,7 +58,6 @@ struct LossySequenceTests { #expect(val.data == nil) } - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Encodes and decodes successfully (LossySequenceTests #23)", .tags(.decoding, .encoding, .lossySequence, .optionals)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalValidData() throws { @@ -75,7 +68,6 @@ struct LossySequenceTests { #expect(data == json) } - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Decodes from JSON successfully (LossySequenceTests #62)", .tags(.decoding, .lossySequence, .optionals)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func optionalInvalidData() throws { @@ -84,7 +76,6 @@ struct LossySequenceTests { #expect(val.data == ["1", "2"]) } - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Decodes from JSON successfully (LossySequenceTests #63)", .tags(.decoding, .lossySequence)) @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultInvalidDataType() throws { @@ -95,7 +86,6 @@ struct LossySequenceTests { @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Decodes from JSON successfully (LossySequenceTests #64)", .tags(.decoding, .lossySequence)) - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultEmptyData() throws { let json = #"{"data":[]}"#.data(using: .utf8)! let val = try JSONDecoder().decode(DefaultContainer.self, from: json) @@ -104,7 +94,6 @@ struct LossySequenceTests { @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Encodes and decodes successfully (LossySequenceTests #24)", .tags(.decoding, .encoding, .lossySequence)) - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultValidData() throws { let json = #"{"data":["1","2"]}"#.data(using: .utf8)! let val = try JSONDecoder().decode(DefaultContainer.self, from: json) @@ -115,7 +104,6 @@ struct LossySequenceTests { @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") @Test("Decodes from JSON successfully (LossySequenceTests #65)", .tags(.decoding, .lossySequence)) - @available(*, deprecated, message: "Tesing deprecated LossySequenceCoder") func defaultInvalidData() throws { let json = #"{"data":[1,"1",2,"2"]}"#.data(using: .utf8)! let val = try JSONDecoder().decode(DefaultContainer.self, from: json) diff --git a/Tests/MetaCodableTests/Tags.swift b/Tests/MetaCodableTests/Tags.swift index 783c522b80..433f3d0b66 100644 --- a/Tests/MetaCodableTests/Tags.swift +++ b/Tests/MetaCodableTests/Tags.swift @@ -1,55 +1,58 @@ import Testing -/// Test tags for organizing and filtering MetaCodable tests. +// MARK: Test Tags + +/// Test tags for organizing and filtering `MetaCodable` tests. extension Tag { - // MARK: - Macro Tags - /// Tests for @Codable macro + // MARK: Macro + + /// Tests for `@Codable` macro @Tag static var codable: Self - /// Tests for @CodedAt macro + /// Tests for `@CodedAt` macro @Tag static var codedAt: Self - /// Tests for @CodedIn macro + /// Tests for `@CodedIn` macro @Tag static var codedIn: Self - /// Tests for @CodedBy macro + /// Tests for `@CodedBy` macro @Tag static var codedBy: Self - /// Tests for @CodedAs macro + /// Tests for `@CodedAs` macro @Tag static var codedAs: Self - /// Tests for @CodingKeys macro + /// Tests for `@CodingKeys` macro @Tag static var codingKeys: Self - /// Tests for @Default macro + /// Tests for `@Default` macro @Tag static var `default`: Self - /// Tests for @IgnoreCoding macro + /// Tests for `@IgnoreCoding` macro @Tag static var ignoreCoding: Self - /// Tests for @IgnoreDecoding macro + /// Tests for `@IgnoreDecoding` macro @Tag static var ignoreDecoding: Self - /// Tests for @IgnoreEncoding macro + /// Tests for `@IgnoreEncoding` macro @Tag static var ignoreEncoding: Self - /// Tests for @IgnoreCodingInitialized macro + /// Tests for `@IgnoreCodingInitialized` macro @Tag static var ignoreCodingInitialized: Self - /// Tests for @ContentAt macro + /// Tests for `@ContentAt` macro @Tag static var contentAt: Self - /// Tests for @UnTagged macro + /// Tests for `@UnTagged` macro @Tag static var untagged: Self - /// Tests for @MemberInit macro + /// Tests for `@MemberInit` macro @Tag static var memberInit: Self - /// Tests for @Inherits macro + /// Tests for `@Inherits` macro @Tag static var inherits: Self - // MARK: - Test Type Tags + // MARK: Test Type /// Tests that verify macro expansion output @Tag static var macroExpansion: Self @@ -66,9 +69,9 @@ extension Tag { /// Integration tests combining multiple features @Tag static var integration: Self - // MARK: - Feature Tags + // MARK: Feature - /// Tests for HelperCoder and related types + /// Tests for `HelperCoder` and related types @Tag static var helperCoders: Self /// Tests for dynamic coding features @@ -83,32 +86,32 @@ extension Tag { /// Tests for access modifier handling @Tag static var accessModifiers: Self - /// Tests for optional/nil handling + /// Tests for `Optional`/`nil` handling @Tag static var optionals: Self - /// Tests for enum types + /// Tests for `enum` types @Tag static var enums: Self - /// Tests for struct types + /// Tests for `struct` types @Tag static var structs: Self - /// Tests for class types + /// Tests for `class` types @Tag static var classes: Self - /// Tests for raw representable types + /// Tests for `RawRepresentable` types @Tag static var rawRepresentable: Self - // MARK: - Coverage Tags + // MARK: Coverage /// Tests created specifically for coverage improvement @Tag static var coverage: Self - // MARK: - Helper Coder Tags + // MARK: Helper Coder /// Tests for date coders @Tag static var dateCoder: Self - /// Tests for data coders (Base64) + /// Tests for data coders (`Base64`) @Tag static var dataCoder: Self /// Tests for sequence coders