Skip to content

Commit

Permalink
Fixed missing UserDefaults conditional compilations
Browse files Browse the repository at this point in the history
  • Loading branch information
bok- committed Jul 17, 2024
1 parent 6037028 commit cd0bb12
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/Vexil/Pole.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,13 @@ public final class FlagPole<RootGroup>: Sendable where RootGroup: FlagContainer
/// - `UserDefaults.standard`
///
public static var defaultSources: [any FlagValueSource] {
#if !os(Linux)
[
FlagValueSourceCoordinator(source: UserDefaults.standard),
]
#else
[]
#endif
}


Expand Down
13 changes: 13 additions & 0 deletions Tests/VexilTests/FlagPoleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ final class FlagPoleTestCase: XCTestCase {
@Suite("Flag Pole")
struct FlagPoleTests {


#if !os(Linux)

@Test("Sets default sources", .tags(.pole))
func setsDefaultSources() throws {
let pole = FlagPole(hoist: TestFlags.self)
Expand All @@ -41,6 +44,16 @@ struct FlagPoleTests {
}
}

#else

@Test("Sets default sources", .tags(.pole))
func setsDefaultSources() throws {
let pole = FlagPole(hoist: TestFlags.self)
#expect(pole._sources.isEmpty)
}

#endif

}

// MARK: - Fixtures
Expand Down

0 comments on commit cd0bb12

Please sign in to comment.