Skip to content

Commit d55b14b

Browse files
committed
[test] MinimalHashable{Value,Class}: Implement CustomStringConvertible
This makes it easier to understand failure traces in test logs.
1 parent f873a51 commit d55b14b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

stdlib/private/StdlibUnittest/MinimalTypes.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ public struct MinimalHashableValue : Equatable, Hashable {
145145
}
146146
}
147147

148+
extension MinimalHashableValue: CustomStringConvertible {
149+
public var description: String {
150+
return "MinimalHashableValue(value: \(value), identity: \(identity))"
151+
}
152+
}
148153

149154

150155
/// A type that conforms only to `Equatable` and `Hashable`.
@@ -187,6 +192,11 @@ public class MinimalHashableClass : Equatable, Hashable {
187192
}
188193
}
189194

195+
extension MinimalHashableClass: CustomStringConvertible {
196+
public var description: String {
197+
return "MinimalHashableClass(value: \(value), identity: \(identity))"
198+
}
199+
}
190200

191201

192202

@@ -234,6 +244,11 @@ public struct GenericMinimalHashableValue<Wrapped> : Equatable, Hashable {
234244
}
235245
}
236246

247+
extension GenericMinimalHashableValue: CustomStringConvertible {
248+
public var description: String {
249+
return "GenericMinimalHashableValue(value: \(value), identity: \(identity))"
250+
}
251+
}
237252

238253
public var GenericMinimalHashableClass_timesEqualEqualWasCalled: Int = 0
239254
public var GenericMinimalHashableClass_timesHashValueWasCalled: Int = 0
@@ -279,6 +294,11 @@ public class GenericMinimalHashableClass<Wrapped> : Equatable, Hashable {
279294
}
280295
}
281296

297+
extension GenericMinimalHashableClass: CustomStringConvertible {
298+
public var description: String {
299+
return "GenericMinimalHashableClass(value: \(value), identity: \(identity))"
300+
}
301+
}
282302

283303

284304
/// A type that conforms only to `Equatable`, `Comparable`, and `Strideable`.

0 commit comments

Comments
 (0)