mirror of
https://github.com/apple/swift-system
synced 2026-11-30 05:28:49 +00:00
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:
1 parent
faffb9a15a
commit
ad407249fe
1 file changed
+14
-4
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user