diff --git a/Tests/DefaultsMacrosDeclarationsTests/ObservableDefaultMacroTests.swift b/Tests/DefaultsMacrosDeclarationsTests/ObservableDefaultMacroTests.swift index d3b0526..149d931 100644 --- a/Tests/DefaultsMacrosDeclarationsTests/ObservableDefaultMacroTests.swift +++ b/Tests/DefaultsMacrosDeclarationsTests/ObservableDefaultMacroTests.swift @@ -1,6 +1,6 @@ import SwiftSyntaxMacros import SwiftSyntaxMacrosTestSupport -import Testing +import XCTest // Macro implementations build for the host, so the corresponding module is not available when cross-compiling. // Cross-compiled tests may still make use of the macro itself in end-to-end tests. @@ -15,10 +15,9 @@ let testMacros: [String: Macro.Type] = [ let testMacros: [String: Macro.Type] = [:] #endif -@Suite(.serialized) -final class ObservableDefaultMacroTests { - @Test(.disabled(if: testMacros.isEmpty)) +final class ObservableDefaultMacroTests: XCTestCase { func testExpansionWithMemberSyntax() throws { + #if canImport(DefaultsMacrosDeclarations) assertMacroExpansion( #""" @Observable @@ -49,10 +48,13 @@ final class ObservableDefaultMacroTests { macros: testMacros, indentationWidth: .tabs(1) ) + #else + throw XCTSkip("Macros are only supported when running tests for the host platform") + #endif } - @Test(.disabled(if: testMacros.isEmpty)) func testExpansionWithDotSyntax() throws { + #if canImport(DefaultsMacrosDeclarations) assertMacroExpansion( #""" @Observable @@ -83,10 +85,13 @@ final class ObservableDefaultMacroTests { macros: testMacros, indentationWidth: .tabs(1) ) + #else + throw XCTSkip("Macros are only supported when running tests for the host platform") + #endif } - @Test(.disabled(if: testMacros.isEmpty)) func testExpansionWithFunctionCall() throws { + #if canImport(DefaultsMacrosDeclarations) assertMacroExpansion( #""" @Observable @@ -117,10 +122,13 @@ final class ObservableDefaultMacroTests { macros: testMacros, indentationWidth: .tabs(1) ) + #else + throw XCTSkip("Macros are only supported when running tests for the host platform") + #endif } - @Test(.disabled(if: testMacros.isEmpty)) func testExpansionWithProperty() throws { + #if canImport(DefaultsMacrosDeclarations) assertMacroExpansion( #""" @Observable @@ -151,5 +159,8 @@ final class ObservableDefaultMacroTests { macros: testMacros, indentationWidth: .tabs(1) ) + #else + throw XCTSkip("Macros are only supported when running tests for the host platform") + #endif } }