From 47feb93a38cc69af60411392977ac30e53fe7cf7 Mon Sep 17 00:00:00 2001 From: Daniel Loffgren Date: Wed, 21 Dec 2022 13:43:26 -0800 Subject: [PATCH] Add a test that ensures makeSendOnce is creating unique send-once rights --- Tests/SystemTests/MachPortTests.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tests/SystemTests/MachPortTests.swift b/Tests/SystemTests/MachPortTests.swift index 0def85a..7faa976 100644 --- a/Tests/SystemTests/MachPortTests.swift +++ b/Tests/SystemTests/MachPortTests.swift @@ -110,6 +110,17 @@ final class MachPortTests: XCTestCase { XCTAssert(same == zero) } + func testMakeSendOnceIsUnique() throws { + let recv = Mach.Port() + let once = recv.makeSendOnceRight() + recv.withBorrowedName { rname in + once.withBorrowedName { oname in + print(oname, rname) + XCTAssert(oname != rname) + } + } + } + func testMakePair() throws { let (recv, send) = Mach.allocatePortRightPair() XCTAssert(recv.makeSendCount == 1)