Skip to content

Commit faffb9a

Browse files
glessardloffgren
andauthored
Apply suggestions from code review
This better communicates the intention. Co-authored-by: loffgren <[email protected]>
1 parent 8730f2c commit faffb9a

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Tests/SystemTests/MachPortTests.swift

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,23 +188,15 @@ final class MachPortTests: XCTestCase {
188188
let recv = Mach.Port<Mach.ReceiveRight>()
189189
let send = recv.makeSendRight()
190190
_ = consume recv // and turn `send` into a dead name
191-
do {
192-
let copy = try send.copySendRight()
193-
_ = copy
194-
}
195-
catch Mach.PortRightError.deadName {
196-
// success
191+
XCTAssertThrowsError(try send.copySendRight(), "Copying a dead name should throw") { error in
192+
XCTAssertEqual(error, Mach.PortRightError.deadName)
197193
}
198194
}
199195

200196
func testCopyDeadName2() throws {
201197
let send = Mach.Port<Mach.SendRight>(name: 0xffffffff)
202-
do {
203-
let copy = try send.copySendRight()
204-
_ = copy
205-
}
206-
catch Mach.PortRightError.deadName {
207-
// success
198+
XCTAssertThrowsError(try send.copySendRight(), "Copying a dead name should throw") { error in
199+
XCTAssertEqual(error, Mach.PortRightError.deadName)
208200
}
209201
}
210202

0 commit comments

Comments
 (0)