Skip to content

Commit 19cc145

Browse files
committed
Fix Linux CI: wrap snapshot tests in #if canImport(Darwin)
The #TestSuites macro only generates Test.Snapshot suite on Darwin platforms. Wrapped all Test.Snapshot extensions with conditional compilation to fix Linux build failures.
1 parent f708f57 commit 19cc145

8 files changed

Lines changed: 18 additions & 0 deletions

Tests/HTML Tests/CSS Tests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum CSSNamespace {
1616

1717
// MARK: - Snapshot Tests - Fluent Chaining
1818

19+
#if canImport(Darwin)
1920
extension CSSNamespace.Test.Snapshot {
2021
@Test("Fluent chaining without repeated .css calls")
2122
func fluentChaining() {
@@ -1119,6 +1120,7 @@ extension CSSNamespace.Test.Snapshot {
11191120
}
11201121
}
11211122
}
1123+
#endif
11221124

11231125
// MARK: - Unit Tests - CSS Color
11241126

@@ -1200,6 +1202,7 @@ extension CSSNamespace.Test.Unit {
12001202

12011203
// MARK: - Snapshot Tests - Color with HTML
12021204

1205+
#if canImport(Darwin)
12031206
extension CSSNamespace.Test.Snapshot {
12041207
@Test("General color styling")
12051208
func general1() {
@@ -1438,6 +1441,7 @@ extension CSSNamespace.Test.Snapshot {
14381441
}
14391442
}
14401443
}
1444+
#endif
14411445

14421446
// MARK: - Test Helpers
14431447

Tests/HTML Tests/DarkModeColor Tests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ extension DarkModeColor.Test.Unit {
126126

127127
// MARK: - Snapshot Tests
128128

129+
#if canImport(Darwin)
129130
extension DarkModeColor.Test.Snapshot {
130131
@Test("HTMLColor with light only auto-darkens")
131132
func htmlColorAutoDarken() {
@@ -1052,3 +1053,4 @@ extension DarkModeColor.Test.Snapshot {
10521053
}
10531054
}
10541055
}
1056+
#endif

Tests/HTML Tests/HStack Tests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum HStackTests {
1616

1717
// MARK: - Snapshot Tests
1818

19+
#if canImport(Darwin)
1920
extension HStackTests.Test.Snapshot {
2021
@Test("HStack renders with default settings")
2122
func hstack() {
@@ -59,3 +60,4 @@ extension HStackTests.Test.Snapshot {
5960
}
6061
}
6162
}
63+
#endif

Tests/HTML Tests/HTML.Document Tests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ private struct _CustomButton: HTML.View {
129129

130130
// MARK: - Snapshot Tests
131131

132+
#if canImport(Darwin)
132133
extension HTMLDocumentTests.Test.Snapshot {
133134
@Test("Full document example")
134135
func fullDocumentExample() {
@@ -219,3 +220,4 @@ extension HTMLDocumentTests.Test.Snapshot {
219220
}
220221
}
221222
}
223+
#endif

Tests/HTML Tests/LazyVGrid Tests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ enum LazyVGridTests {
1818

1919
// MARK: - Snapshot Tests
2020

21+
#if canImport(Darwin)
2122
extension LazyVGridTests.Test.Snapshot {
2223
@Test("LazyVGrid with fractions columns")
2324
func lazyVGrid() {
@@ -116,3 +117,4 @@ extension LazyVGridTests.Test.Snapshot {
116117
}
117118
}
118119
}
120+
#endif

Tests/HTML Tests/Spacer Tests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extension Spacer {
1616

1717
// MARK: - Snapshot Tests
1818

19+
#if canImport(Darwin)
1920
extension Spacer.Test.Snapshot {
2021
@Test("Spacer pushes items apart in HStack")
2122
func spacer() {
@@ -41,3 +42,4 @@ extension Spacer.Test.Snapshot {
4142
}
4243
}
4344
}
45+
#endif

Tests/HTML Tests/TranslatedString+HTML Tests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
// MARK: - Snapshot Tests
2323

24+
#if canImport(Darwin)
2425
extension TranslatedStringHTML.Test.Snapshot {
2526
@Test("TranslatedString renders as HTML")
2627
func translatedStringRendersAsHTML() {
@@ -241,4 +242,5 @@
241242
}
242243
}
243244
}
245+
#endif
244246
#endif

Tests/HTML Tests/VStack Tests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum VStackTests {
1616

1717
// MARK: - Snapshot Tests
1818

19+
#if canImport(Darwin)
1920
extension VStackTests.Test.Snapshot {
2021
@Test("VStack renders with default settings")
2122
func vstack() {
@@ -59,3 +60,4 @@ extension VStackTests.Test.Snapshot {
5960
}
6061
}
6162
}
63+
#endif

0 commit comments

Comments
 (0)