Add a test that ensures makeSendOnce is creating unique send-once rights

This commit is contained in:
Daniel Loffgren committed 2022-12-21 13:43:26 -08:00
1 parent 6a9ebce259
commit 47feb93a38
1 file changed
+11
+11
View File
@@ -110,6 +110,17 @@ final class MachPortTests: XCTestCase {
XCTAssert(same == zero)
}
func testMakeSendOnceIsUnique() throws {
let recv = Mach.Port<Mach.ReceiveRight>()
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)