make test expression return Void

- It can’t return `Mach.Port<SendRight>`, because a noncopyable type cannot currently be a generic type argument.
This commit is contained in:
Guillaume Lessard committed 2023-08-16 13:34:41 -07:00
1 parent faffb9a15a
commit ad407249fe
1 file changed
+14 -4
+14 -4
View File
@@ -188,15 +188,25 @@ final class MachPortTests: XCTestCase {
let recv = Mach.Port<Mach.ReceiveRight>()
let send = recv.makeSendRight()
_ = consume recv // and turn `send` into a dead name
XCTAssertThrowsError(try send.copySendRight(), "Copying a dead name should throw") { error in
XCTAssertEqual(error, Mach.PortRightError.deadName)
XCTAssertThrowsError(
_ = try send.copySendRight(),
"Copying a dead name should throw"
) { error in
XCTAssertEqual(
error as! Mach.PortRightError, Mach.PortRightError.deadName
)
}
}
func testCopyDeadName2() throws {
let send = Mach.Port<Mach.SendRight>(name: 0xffffffff)
XCTAssertThrowsError(try send.copySendRight(), "Copying a dead name should throw") { error in
XCTAssertEqual(error, Mach.PortRightError.deadName)
XCTAssertThrowsError(
_ = try send.copySendRight(),
"Copying a dead name should throw"
) { error in
XCTAssertEqual(
error as! Mach.PortRightError, Mach.PortRightError.deadName
)
}
}