File tree Expand file tree Collapse file tree 4 files changed +42
-63
lines changed Expand file tree Collapse file tree 4 files changed +42
-63
lines changed Original file line number Diff line number Diff line change 1+ #if canImport(Macros)
12import SwiftSyntaxMacros
23import SwiftSyntaxMacrosTestSupport
3- import XCTest
4+ import Testing
45
5- final class AssociatedValuesMacroTests : XCTestCase {
6- func testGenerateVarForAssociatedValues( ) throws {
7- #if canImport(Macros)
6+ @Suite ( " Associated Values Macro " )
7+ struct AssociatedValuesMacroTests {
8+ @Test
9+ func generateVarForAssociatedValues( ) {
810 assertMacroExpansion (
911 """
1012 @AssociatedValues
@@ -66,13 +68,10 @@ final class AssociatedValuesMacroTests: XCTestCase {
6668 macros: testMacros,
6769 indentationWidth: . spaces( 2 )
6870 )
69- #else
70- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
71- #endif
7271 }
7372
74- func testMacroIsOnlySupportEnum ( ) throws {
75- #if canImport(Macros)
73+ @ Test
74+ func macroIsOnlySupportEnum ( ) {
7675 assertMacroExpansion (
7776 #"""
7877 @AssociatedValues
@@ -91,8 +90,6 @@ final class AssociatedValuesMacroTests: XCTestCase {
9190 ] ,
9291 macros: testMacros
9392 )
94- #else
95- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
96- #endif
9793 }
9894}
95+ #endif
Original file line number Diff line number Diff line change 1+ #if canImport(Macros)
12import SwiftSyntaxMacros
23import SwiftSyntaxMacrosTestSupport
3- import XCTest
4+ import Testing
45
5- final class SingletonMacroTests : XCTestCase {
6- func testGenerateAPublicSignletonProperty( ) throws {
7- #if canImport(Macros)
6+ @Suite ( " Singleton Macro " )
7+ struct SingletonMacroTests {
8+ @Test
9+ func generateAPublicSignletonProperty( ) {
810 assertMacroExpansion (
911 """
1012 @Singleton
@@ -24,13 +26,10 @@ final class SingletonMacroTests: XCTestCase {
2426 macros: testMacros,
2527 indentationWidth: . spaces( 2 )
2628 )
27- #else
28- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
29- #endif
3029 }
3130
32- func testGenerateASignletonProperty ( ) throws {
33- #if canImport(Macros)
31+ @ Test
32+ func generateASignletonProperty ( ) {
3433 assertMacroExpansion (
3534 """
3635 @Singleton
@@ -50,13 +49,10 @@ final class SingletonMacroTests: XCTestCase {
5049 macros: testMacros,
5150 indentationWidth: . spaces( 2 )
5251 )
53- #else
54- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
55- #endif
5652 }
5753
58- func testMacroIsOnlySupportClassOrStruct ( ) throws {
59- #if canImport(Macros)
54+ @ Test
55+ func macroIsOnlySupportClassOrStruct ( ) {
6056 assertMacroExpansion (
6157 """
6258 @Singleton
@@ -73,8 +69,6 @@ final class SingletonMacroTests: XCTestCase {
7369 ] ,
7470 macros: testMacros
7571 )
76- #else
77- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
78- #endif
7972 }
8073}
74+ #endif
Original file line number Diff line number Diff line change 1+ #if canImport(Macros)
12import SwiftSyntaxMacros
23import SwiftSyntaxMacrosTestSupport
3- import XCTest
4+ import Testing
45
5- final class SymbolMacroTests : XCTestCase {
6- func testValidSymbol( ) throws {
7- #if canImport(Macros)
6+ @Suite ( " Symbol Macro " )
7+ struct SymbolMacroTests {
8+ @Test
9+ func validSymbol( ) {
810 assertMacroExpansion (
911 """
1012 #symbol( " swift " )
@@ -15,13 +17,10 @@ final class SymbolMacroTests: XCTestCase {
1517 """ ,
1618 macros: testMacros
1719 )
18- #else
19- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
20- #endif
2120 }
2221
23- func testInvalidSymbol ( ) throws {
24- #if canImport(Macros)
22+ @ Test
23+ func invalidSymbol ( ) {
2524 assertMacroExpansion (
2625 """
2726 #symbol( " test " )
@@ -35,13 +34,10 @@ final class SymbolMacroTests: XCTestCase {
3534 ] ,
3635 macros: testMacros
3736 )
38- #else
39- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
40- #endif
4137 }
4238
43- func testParseNameError ( ) throws {
44- #if canImport(Macros)
39+ @ Test
40+ func parseSymbolNameWithError ( ) {
4541 assertMacroExpansion (
4642 #"""
4743 #symbol("\("swift")")
@@ -55,8 +51,6 @@ final class SymbolMacroTests: XCTestCase {
5551 ] ,
5652 macros: testMacros
5753 )
58- #else
59- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
60- #endif
6154 }
6255}
56+ #endif
Original file line number Diff line number Diff line change 1+ #if canImport(Macros)
12import SwiftSyntaxMacros
23import SwiftSyntaxMacrosTestSupport
3- import XCTest
4+ import Testing
45
5- final class URLMacroTests : XCTestCase {
6- func testValidURL( ) throws {
7- #if canImport(Macros)
6+ @Suite ( " URL Macro " )
7+ struct URLMacroTests {
8+ @Test
9+ func validURL( ) {
810 assertMacroExpansion (
911 """
1012 #URL( " https://www.apple.com " )
@@ -15,13 +17,10 @@ final class URLMacroTests: XCTestCase {
1517 """ ,
1618 macros: testMacros
1719 )
18- #else
19- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
20- #endif
2120 }
2221
23- func testURLStringLiteralError ( ) throws {
24- #if canImport(Macros)
22+ @ Test
23+ func UrlStringLiteralError ( ) {
2524 assertMacroExpansion (
2625 #"""
2726 #URL("https://www.apple.com\(Int.random())")
@@ -35,13 +34,10 @@ final class URLMacroTests: XCTestCase {
3534 ] ,
3635 macros: testMacros
3736 )
38- #else
39- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
40- #endif
4137 }
4238
43- func testMalformedURLError ( ) throws {
44- #if canImport(Macros)
39+ @ Test
40+ func malformedURLError ( ) {
4541 assertMacroExpansion (
4642 """
4743 #URL( " https://www. apple.com " )
@@ -55,8 +51,6 @@ final class URLMacroTests: XCTestCase {
5551 ] ,
5652 macros: testMacros
5753 )
58- #else
59- throw XCTSkip ( " macros are only supported when running tests for the host platform " )
60- #endif
6154 }
6255}
56+ #endif
You can’t perform that action at this time.
0 commit comments