@@ -44,13 +44,19 @@ import Testing
4444 let output = try await SwiftlyTests . runWithMockedIO ( List . self, args)
4545
4646 let parsedToolchains = output. compactMap { outputLine in
47+ #if !os(macOS)
4748 Set < ToolchainVersion > . allToolchains ( ) . first {
4849 outputLine. contains ( String ( describing: $0) )
4950 }
51+ #else
52+ ( Set < ToolchainVersion > . allToolchains ( ) + [ . xcodeVersion] ) . first {
53+ outputLine. contains ( String ( describing: $0) )
54+ }
55+ #endif
5056 }
5157
5258 // Ensure extra toolchains weren't accidentally included in the output.
53- guard parsedToolchains. count == output. filter ( { $0. hasPrefix ( " Swift " ) || $0. contains ( " -snapshot " ) } ) . count else {
59+ guard parsedToolchains. count == output. filter ( { $0. hasPrefix ( " Swift " ) || $0. contains ( " -snapshot " ) || $0 . contains ( " xcode " ) } ) . count else {
5460 throw SwiftlyTestError ( message: " unexpected listed toolchains in \( output) " )
5561 }
5662
@@ -62,7 +68,11 @@ import Testing
6268 @Test func list( ) async throws {
6369 try await self . runListTest {
6470 let toolchains = try await self . runList ( selector: nil )
71+ #if !os(macOS)
6572 #expect( toolchains == Self . sortedReleaseToolchains + Self. sortedSnapshotToolchains)
73+ #else
74+ #expect( toolchains == Self . sortedReleaseToolchains + Self. sortedSnapshotToolchains + [ . xcodeVersion] )
75+ #endif
6676 }
6777 }
6878
@@ -155,8 +165,14 @@ import Testing
155165
156166 /// Tests that `list` properly handles the case where no toolchains have been installed yet.
157167 @Test ( . testHome( Self . homeName) ) func listEmpty( ) async throws {
168+ #if !os(macOS)
169+ let systemToolchains : [ ToolchainVersion ] = [ ]
170+ #else
171+ let systemToolchains : [ ToolchainVersion ] = [ . xcodeVersion]
172+ #endif
173+
158174 var toolchains = try await self . runList ( selector: nil )
159- #expect( toolchains == [ ] )
175+ #expect( toolchains == systemToolchains )
160176
161177 toolchains = try await self . runList ( selector: " 5 " )
162178 #expect( toolchains == [ ] )
0 commit comments