From ad407249fec4293dbf8b2578ac54b65f98060313 Mon Sep 17 00:00:00 2001 From: Guillaume Lessard Date: Wed, 16 Aug 2023 13:34:41 -0700 Subject: [PATCH] make test expression return `Void` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - It can’t return `Mach.Port`, because a noncopyable type cannot currently be a generic type argument. --- Tests/SystemTests/MachPortTests.swift | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Tests/SystemTests/MachPortTests.swift b/Tests/SystemTests/MachPortTests.swift index 8a6ade6..07b7410 100644 --- a/Tests/SystemTests/MachPortTests.swift +++ b/Tests/SystemTests/MachPortTests.swift @@ -188,15 +188,25 @@ final class MachPortTests: XCTestCase { let recv = Mach.Port() 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(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 + ) } }