pkg/objc: more message send stuff

This commit is contained in:
Mitchell Hashimoto
2022-10-25 20:55:41 -07:00
parent f587b222e7
commit aaaae38fa1
5 changed files with 47 additions and 3 deletions

View File

@@ -26,6 +26,17 @@ test "getClass" {
test "msgSend" {
const testing = std.testing;
const NSObject = Class.getClass("NSObject").?;
// Should work with primitives
const id = NSObject.msgSend(c.id, objc.Sel.registerName("alloc"), .{});
try testing.expect(id != null);
{
const obj: objc.Object = .{ .value = id };
obj.msgSend(void, objc.sel("dealloc"), .{});
}
// Should work with our wrappers
const obj = NSObject.msgSend(objc.Object, objc.Sel.registerName("alloc"), .{});
try testing.expect(obj.value != null);
obj.msgSend(void, objc.sel("dealloc"), .{});
}