Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/mcs/Commands/SyncCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ struct SyncCommand: LockedCommand {

let lockOps = LockfileOperations(environment: env, output: output, shell: shell)

// Handle --lock: checkout locked versions before loading packs
// Handle --lock: checkout locked commits before loading packs
if lock {
try lockOps.checkoutLockedVersions(at: projectPath)
try lockOps.checkoutLockedCommits(at: projectPath)
}

let configurator = Configurator(
Expand Down
2 changes: 1 addition & 1 deletion Sources/mcs/Install/LockfileOperations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct LockfileOperations {
/// Checkout exact pack commits from the lockfile.
/// Aborts if any checkout fails, since `--lock` guarantees reproducibility for git packs.
/// Local packs are skipped (their content is not commit-pinned).
func checkoutLockedVersions(at projectPath: URL) throws {
func checkoutLockedCommits(at projectPath: URL) throws {
guard let lockfile = try Lockfile.load(projectRoot: projectPath) else {
output.error("No mcs.lock.yaml found. Run 'mcs sync' first to create one.")
throw ExitCode.failure
Expand Down
22 changes: 11 additions & 11 deletions Tests/MCSTests/ExternalPackLoaderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -520,37 +520,37 @@ struct ExternalPackLoaderTests {
// MARK: - VersionCompare

@Test("VersionCompare.isCompatible with equal versions")
func semverEqual() {
func versionCompareEqual() {
#expect(VersionCompare.isCompatible(current: "2.0.1", required: "2.0.1"))
}

@Test("VersionCompare.isCompatible with current higher patch")
func semverHigherPatch() {
func versionCompareHigherPatch() {
#expect(VersionCompare.isCompatible(current: "2.0.2", required: "2.0.1"))
}

@Test("VersionCompare.isCompatible with current higher minor")
func semverHigherMinor() {
func versionCompareHigherMinor() {
#expect(VersionCompare.isCompatible(current: "2.1.0", required: "2.0.1"))
}

@Test("VersionCompare.isCompatible with current higher major")
func semverHigherMajor() {
func versionCompareHigherMajor() {
#expect(VersionCompare.isCompatible(current: "3.0.0", required: "2.0.1"))
}

@Test("VersionCompare.isCompatible returns false when current is lower")
func semverIncompatible() {
func versionCompareIncompatible() {
#expect(!VersionCompare.isCompatible(current: "1.9.9", required: "2.0.0"))
}

@Test("VersionCompare.isCompatible returns false when current patch is lower")
func semverLowerPatch() {
func versionCompareLowerPatch() {
#expect(!VersionCompare.isCompatible(current: "2.0.0", required: "2.0.1"))
}

@Test("VersionCompare.parse extracts components correctly")
func semverParse() {
func versionCompareParse() {
let v = VersionCompare.parse("3.14.159")
#expect(v != nil)
#expect(v?.major == 3)
Expand All @@ -559,13 +559,13 @@ struct ExternalPackLoaderTests {
}

@Test("VersionCompare.parse handles invalid input gracefully")
func semverParseInvalid() {
func versionCompareParseInvalid() {
let v = VersionCompare.parse("invalid")
#expect(v == nil)
}

@Test("VersionCompare.parse strips pre-release suffix")
func semverParsePreRelease() {
func versionCompareParsePreRelease() {
let v = VersionCompare.parse("2.1.0-alpha")
#expect(v != nil)
#expect(v?.major == 2)
Expand All @@ -574,14 +574,14 @@ struct ExternalPackLoaderTests {
}

@Test("VersionCompare.isCompatible with pre-release current version")
func semverPreReleaseCompatible() {
func versionComparePreReleaseCompatible() {
#expect(VersionCompare.isCompatible(current: "2.1.0-alpha", required: "2.1.0"))
#expect(VersionCompare.isCompatible(current: "2.1.0-alpha", required: "2.0.0"))
#expect(!VersionCompare.isCompatible(current: "2.1.0-alpha", required: "2.2.0"))
}

@Test("VersionCompare.isCompatible with pre-release required version")
func semverPreReleaseRequired() {
func versionComparePreReleaseRequired() {
#expect(VersionCompare.isCompatible(current: "2.1.0", required: "2.1.0-beta"))
}
}