@@ -19,17 +19,21 @@ import Testing
1919 . oldReleaseSnapshot,
2020 ]
2121
22+ private static let swiftlyVersion = SwiftlyVersion ( major: SwiftlyCore . version. major, minor: 0 , patch: 0 )
23+
2224 /// Constructs a mock home directory with the toolchains listed above installed and runs the provided closure within
2325 /// the context of that home.
2426 func runListTest( f: ( ) async throws -> Void ) async throws {
2527 try await SwiftlyTests . withTestHome ( name: Self . homeName) {
26- for toolchain in Set< ToolchainVersion> . allToolchains( ) {
27- try await SwiftlyTests . installMockedToolchain ( toolchain: toolchain)
28- }
28+ try await SwiftlyTests . withMockedSwiftlyVersion ( latestSwiftlyVersion: Self . swiftlyVersion) {
29+ for toolchain in Set< ToolchainVersion> . allToolchains( ) {
30+ try await SwiftlyTests . installMockedToolchain ( toolchain: toolchain)
31+ }
2932
30- try await SwiftlyTests . runCommand ( Use . self, [ " use " , " latest " ] )
33+ try await SwiftlyTests . runCommand ( Use . self, [ " use " , " latest " ] )
3134
32- try await f ( )
35+ try await f ( )
36+ }
3337 }
3438 }
3539
@@ -155,16 +159,18 @@ import Testing
155159
156160 /// Tests that `list` properly handles the case where no toolchains have been installed yet.
157161 @Test ( . testHome( Self . homeName) ) func listEmpty( ) async throws {
158- var toolchains = try await self . runList ( selector: nil )
159- #expect( toolchains == [ ] )
162+ try await SwiftlyTests . withMockedSwiftlyVersion ( latestSwiftlyVersion: Self . swiftlyVersion) {
163+ var toolchains = try await self . runList ( selector: nil )
164+ #expect( toolchains == [ ] )
160165
161- toolchains = try await self . runList ( selector: " 5 " )
162- #expect( toolchains == [ ] )
166+ toolchains = try await self . runList ( selector: " 5 " )
167+ #expect( toolchains == [ ] )
163168
164- toolchains = try await self . runList ( selector: " main-snapshot " )
165- #expect( toolchains == [ ] )
169+ toolchains = try await self . runList ( selector: " main-snapshot " )
170+ #expect( toolchains == [ ] )
166171
167- toolchains = try await self . runList ( selector: " 5.7-snapshot " )
168- #expect( toolchains == [ ] )
172+ toolchains = try await self . runList ( selector: " 5.7-snapshot " )
173+ #expect( toolchains == [ ] )
174+ }
169175 }
170176}
0 commit comments