Skip to content

Commit

Permalink
Test a few different ways of sending messages that mutate the receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jun 6, 2022
1 parent cdea41a commit 0925705
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions objc2/src/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,26 @@ impl<'a> From<VerificationError<'a>> for MessageError {
#[cfg(test)]
mod tests {
use super::*;
use crate::rc::{Id, Owned};
use crate::test_utils;

#[allow(unused)]
fn test_different_receivers(mut obj: Id<Object, Owned>) {
unsafe {
let x = &mut obj;
let _: () = msg_send![x, mutable1];
// let _: () = msg_send![x, mutable2];
let _: () = msg_send![&mut *obj, mutable1];
let _: () = msg_send![&mut *obj, mutable2];
let obj: NonNull<Object> = (&mut *obj).into();
let _: () = msg_send![obj, mutable1];
let _: () = msg_send![obj, mutable2];
let obj: *mut Object = obj.as_ptr();
let _: () = msg_send![obj, mutable1];
let _: () = msg_send![obj, mutable2];
}
}

#[test]
fn test_send_message() {
let mut obj = test_utils::custom_object();
Expand Down

0 comments on commit 0925705

Please sign in to comment.