Skip to content

Commit

Permalink
Add smoke test to objc-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jan 2, 2022
1 parent ad58519 commit 2bb9180
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions objc-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,18 @@ pub use various::*;
///
/// TODO: Replace this with `extern type` to also mark it as `!Sized`.
type OpaqueData = PhantomData<(UnsafeCell<()>, *const UnsafeCell<()>, PhantomPinned)>;

#[cfg(test)]
mod tests {
use super::*;
use std::ffi::CStr;

#[test]
fn smoke() {
// Verify that this library links and works fine by itself
let name = CStr::from_bytes_with_nul(b"abc:def:\0").unwrap();
let sel = unsafe { sel_registerName(name.as_ptr()) };
let rtn = unsafe { CStr::from_ptr(sel_getName(sel)) };
assert_eq!(name, rtn);
}
}

0 comments on commit 2bb9180

Please sign in to comment.