Skip to content

Commit fd627ff

Browse files
committed
StdlibUnittest: add expectEqual(_: Any.Type, _: Any.Type)
1 parent c9d4656 commit fd627ff

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ public func expectOptionalEqual${Generic}(
256256

257257
%end
258258

259+
public func expectEqual(
260+
_ expected: Any.Type, _ actual: Any.Type, ${TRACE}
261+
) {
262+
expectEqualTest(expected, actual, ${trace}, showFrame: false) { $0 == $1 }
263+
}
264+
259265
public func expectLT<T : Comparable>(_ lhs: T, _ rhs: T, ${TRACE}) {
260266
if !(lhs < rhs) {
261267
expectationFailure("\(lhs) < \(rhs)", trace: ${trace})

validation-test/StdlibUnittest/Assertions.swift.gyb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,5 +250,23 @@ AssertionsTestSuite.test("expectEqual<T : Equatable, U : Equatable, V : Equatabl
250250
}
251251
}
252252

253+
AssertionsTestSuite.test("expectEqual(_: Any.Type, _: Any.Type)") {
254+
expectEqual(Int.self, Int.self)
255+
expectFailure {
256+
expectEqual(Int.self, Double.self)
257+
}
258+
259+
class B {}
260+
class D : B {}
261+
expectEqual(B.self, B.self)
262+
expectFailure {
263+
expectEqual(B.self, D.self)
264+
}
265+
expectFailure {
266+
expectEqual(D.self, B.self)
267+
}
268+
expectEqual(D.self, D.self)
269+
}
270+
253271
runAllTests()
254272

0 commit comments

Comments
 (0)