diff --git a/Tests/MacroTests/AssociatedValuesMacroTests.swift b/Tests/MacroTests/AssociatedValuesMacroTests.swift index 4c77b94..d46d8b2 100644 --- a/Tests/MacroTests/AssociatedValuesMacroTests.swift +++ b/Tests/MacroTests/AssociatedValuesMacroTests.swift @@ -1,10 +1,12 @@ +#if canImport(Macros) import SwiftSyntaxMacros import SwiftSyntaxMacrosTestSupport -import XCTest +import Testing -final class AssociatedValuesMacroTests: XCTestCase { - func testGenerateVarForAssociatedValues() throws { - #if canImport(Macros) +@Suite("Associated Values Macro") +struct AssociatedValuesMacroTests { + @Test + func generateVarForAssociatedValues() { assertMacroExpansion( """ @AssociatedValues @@ -66,13 +68,10 @@ final class AssociatedValuesMacroTests: XCTestCase { macros: testMacros, indentationWidth: .spaces(2) ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } - func testMacroIsOnlySupportEnum() throws { - #if canImport(Macros) + @Test + func macroIsOnlySupportEnum() { assertMacroExpansion( #""" @AssociatedValues @@ -91,8 +90,6 @@ final class AssociatedValuesMacroTests: XCTestCase { ], macros: testMacros ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } } +#endif diff --git a/Tests/MacroTests/SingletonMacroTests.swift b/Tests/MacroTests/SingletonMacroTests.swift index 665147a..582f923 100644 --- a/Tests/MacroTests/SingletonMacroTests.swift +++ b/Tests/MacroTests/SingletonMacroTests.swift @@ -1,10 +1,12 @@ +#if canImport(Macros) import SwiftSyntaxMacros import SwiftSyntaxMacrosTestSupport -import XCTest +import Testing -final class SingletonMacroTests: XCTestCase { - func testGenerateAPublicSignletonProperty() throws { - #if canImport(Macros) +@Suite("Singleton Macro") +struct SingletonMacroTests { + @Test + func generateAPublicSignletonProperty() { assertMacroExpansion( """ @Singleton @@ -24,13 +26,10 @@ final class SingletonMacroTests: XCTestCase { macros: testMacros, indentationWidth: .spaces(2) ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } - func testGenerateASignletonProperty() throws { - #if canImport(Macros) + @Test + func generateASignletonProperty() { assertMacroExpansion( """ @Singleton @@ -50,13 +49,10 @@ final class SingletonMacroTests: XCTestCase { macros: testMacros, indentationWidth: .spaces(2) ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } - func testMacroIsOnlySupportClassOrStruct() throws { - #if canImport(Macros) + @Test + func macroIsOnlySupportClassOrStruct() { assertMacroExpansion( """ @Singleton @@ -73,8 +69,6 @@ final class SingletonMacroTests: XCTestCase { ], macros: testMacros ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } } +#endif diff --git a/Tests/MacroTests/SymbolMacroTests.swift b/Tests/MacroTests/SymbolMacroTests.swift index 65bf1a3..b7d975a 100644 --- a/Tests/MacroTests/SymbolMacroTests.swift +++ b/Tests/MacroTests/SymbolMacroTests.swift @@ -1,10 +1,12 @@ +#if canImport(Macros) import SwiftSyntaxMacros import SwiftSyntaxMacrosTestSupport -import XCTest +import Testing -final class SymbolMacroTests: XCTestCase { - func testValidSymbol() throws { - #if canImport(Macros) +@Suite("Symbol Macro") +struct SymbolMacroTests { + @Test + func validSymbol() { assertMacroExpansion( """ #symbol("swift") @@ -15,13 +17,10 @@ final class SymbolMacroTests: XCTestCase { """, macros: testMacros ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } - func testInvalidSymbol() throws { - #if canImport(Macros) + @Test + func invalidSymbol() { assertMacroExpansion( """ #symbol("test") @@ -35,13 +34,10 @@ final class SymbolMacroTests: XCTestCase { ], macros: testMacros ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } - func testParseNameError() throws { - #if canImport(Macros) + @Test + func parseSymbolNameWithError() { assertMacroExpansion( #""" #symbol("\("swift")") @@ -55,8 +51,6 @@ final class SymbolMacroTests: XCTestCase { ], macros: testMacros ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } } +#endif diff --git a/Tests/MacroTests/URLMacroTests.swift b/Tests/MacroTests/URLMacroTests.swift index 4694a1a..73fb69a 100644 --- a/Tests/MacroTests/URLMacroTests.swift +++ b/Tests/MacroTests/URLMacroTests.swift @@ -1,10 +1,12 @@ +#if canImport(Macros) import SwiftSyntaxMacros import SwiftSyntaxMacrosTestSupport -import XCTest +import Testing -final class URLMacroTests: XCTestCase { - func testValidURL() throws { - #if canImport(Macros) +@Suite("URL Macro") +struct URLMacroTests { + @Test + func validURL() { assertMacroExpansion( """ #URL("https://www.apple.com") @@ -15,13 +17,10 @@ final class URLMacroTests: XCTestCase { """, macros: testMacros ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } - func testURLStringLiteralError() throws { - #if canImport(Macros) + @Test + func UrlStringLiteralError() { assertMacroExpansion( #""" #URL("https://www.apple.com\(Int.random())") @@ -35,13 +34,10 @@ final class URLMacroTests: XCTestCase { ], macros: testMacros ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } - func testMalformedURLError() throws { - #if canImport(Macros) + @Test + func malformedURLError() { assertMacroExpansion( """ #URL("https://www. apple.com") @@ -55,8 +51,6 @@ final class URLMacroTests: XCTestCase { ], macros: testMacros ) - #else - throw XCTSkip("macros are only supported when running tests for the host platform") - #endif } } +#endif