Skip to content

Commit 8e4d722

Browse files
committed
Implement custom equatable for Triple
It seems like equality for triples should depend on the parsed version and exclude the initial string representation. Eventually, we should probably get rid of storing the original string and compute that from the parsed version, but I am just trying to address equality for now.
1 parent 82a554a commit 8e4d722

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/TSCUtility/Triple.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ public struct Triple: Encodable, Equatable {
197197
fatalError("Failed to parse triple string (\(error)).\nTriple string: \(tripleString)")
198198
}
199199
}
200+
201+
public static func ==(lhs: Triple, rhs: Triple) -> Bool {
202+
return lhs.arch == rhs.arch && lhs.vendor == rhs.vendor && lhs.os == rhs.os && lhs.abi == rhs.abi && lhs.osVersion == rhs.osVersion && lhs.abiVersion == rhs.abiVersion
203+
}
200204
}
201205

202206
extension Triple {

0 commit comments

Comments
 (0)