Skip to content

Commit 1787f10

Browse files
test(Use): mock swiftly verison
1 parent 83a6bc9 commit 1787f10

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Tests/SwiftlyTests/UseTests.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ import Testing
1616
}
1717

1818
/// Tests that the `use` command can switch between installed stable release toolchains.
19-
@Test(.mockHomeToolchains()) func useStable() async throws {
19+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains()) func useStable() async throws {
2020
try await self.useAndValidate(argument: ToolchainVersion.oldStable.name, expectedVersion: .oldStable)
2121
try await self.useAndValidate(argument: ToolchainVersion.newStable.name, expectedVersion: .newStable)
2222
try await self.useAndValidate(argument: ToolchainVersion.newStable.name, expectedVersion: .newStable)
2323
}
2424

2525
/// Tests that that "latest" can be provided to the `use` command to select the installed stable release
2626
/// toolchain with the most recent version.
27-
@Test(.mockHomeToolchains()) func useLatestStable() async throws {
27+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains()) func useLatestStable() async throws {
2828
// Use an older toolchain.
2929
try await self.useAndValidate(argument: ToolchainVersion.oldStable.name, expectedVersion: .oldStable)
3030

@@ -43,7 +43,7 @@ import Testing
4343

4444
/// Tests that the latest installed patch release toolchain for a given major/minor version pair can be selected by
4545
/// omitting the patch version (e.g. `use 5.6`).
46-
@Test(.mockHomeToolchains()) func useLatestStablePatch() async throws {
46+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains()) func useLatestStablePatch() async throws {
4747
try await self.useAndValidate(argument: ToolchainVersion.oldStable.name, expectedVersion: .oldStable)
4848

4949
let oldStableVersion = ToolchainVersion.oldStable.asStableRelease!
@@ -71,7 +71,7 @@ import Testing
7171
}
7272

7373
/// Tests that the `use` command can switch between installed main snapshot toolchains.
74-
@Test(.mockHomeToolchains()) func useMainSnapshot() async throws {
74+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains()) func useMainSnapshot() async throws {
7575
// Switch to a non-snapshot.
7676
try await self.useAndValidate(argument: ToolchainVersion.newStable.name, expectedVersion: .newStable)
7777
try await self.useAndValidate(argument: ToolchainVersion.oldMainSnapshot.name, expectedVersion: .oldMainSnapshot)
@@ -83,7 +83,7 @@ import Testing
8383

8484
/// Tests that the latest installed main snapshot toolchain can be selected by omitting the
8585
/// date (e.g. `use main-snapshot`).
86-
@Test(.mockHomeToolchains()) func useLatestMainSnapshot() async throws {
86+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains()) func useLatestMainSnapshot() async throws {
8787
// Switch to a non-snapshot.
8888
try await self.useAndValidate(argument: ToolchainVersion.newStable.name, expectedVersion: .newStable)
8989
// Switch to the latest main snapshot.
@@ -97,7 +97,7 @@ import Testing
9797
}
9898

9999
/// Tests that the `use` command can switch between installed release snapshot toolchains.
100-
@Test(.mockHomeToolchains()) func useReleaseSnapshot() async throws {
100+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains()) func useReleaseSnapshot() async throws {
101101
// Switch to a non-snapshot.
102102
try await self.useAndValidate(argument: ToolchainVersion.newStable.name, expectedVersion: .newStable)
103103
try await self.useAndValidate(
@@ -121,7 +121,7 @@ import Testing
121121

122122
/// Tests that the latest installed release snapshot toolchain can be selected by omitting the
123123
/// date (e.g. `use 5.7-snapshot`).
124-
@Test(.mockHomeToolchains()) func useLatestReleaseSnapshot() async throws {
124+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains()) func useLatestReleaseSnapshot() async throws {
125125
// Switch to a non-snapshot.
126126
try await self.useAndValidate(argument: ToolchainVersion.newStable.name, expectedVersion: .newStable)
127127
// Switch to the latest snapshot for the given release.
@@ -150,7 +150,7 @@ import Testing
150150
}
151151

152152
/// Tests that the `use` command gracefully exits when executed before any toolchains have been installed.
153-
@Test(.mockHomeToolchains(toolchains: [])) func useNoInstalledToolchains() async throws {
153+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains(toolchains: [])) func useNoInstalledToolchains() async throws {
154154
try await SwiftlyTests.runCommand(Use.self, ["use", "-g", "latest"])
155155

156156
var config = try await Config.load()
@@ -163,7 +163,7 @@ import Testing
163163
}
164164

165165
/// Tests that the `use` command gracefully handles being executed with toolchain names that haven't been installed.
166-
@Test(.mockHomeToolchains()) func useNonExistent() async throws {
166+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains()) func useNonExistent() async throws {
167167
// Switch to a valid toolchain.
168168
try await self.useAndValidate(argument: ToolchainVersion.oldStable.name, expectedVersion: .oldStable)
169169

@@ -175,7 +175,7 @@ import Testing
175175
}
176176

177177
/// Tests that the `use` command works with all the installed toolchains in this test harness.
178-
@Test(.mockHomeToolchains()) func useAll() async throws {
178+
@Test(.mockedSwiftlyVersion(), .mockHomeToolchains()) func useAll() async throws {
179179
let config = try await Config.load()
180180

181181
for toolchain in config.installedToolchains {
@@ -187,7 +187,7 @@ import Testing
187187
}
188188

189189
/// Tests that running a use command without an argument prints the currently in-use toolchain.
190-
@Test func printInUse() async throws {
190+
@Test(.mockedSwiftlyVersion()) func printInUse() async throws {
191191
let toolchains = [
192192
ToolchainVersion.newStable,
193193
.newMainSnapshot,
@@ -209,7 +209,7 @@ import Testing
209209
}
210210

211211
/// Tests in-use toolchain selected by the .swift-version file.
212-
@Test func swiftVersionFile() async throws {
212+
@Test(.mockedSwiftlyVersion()) func swiftVersionFile() async throws {
213213
let toolchains = [
214214
ToolchainVersion.newStable,
215215
.newMainSnapshot,

0 commit comments

Comments
 (0)