diff options
Diffstat (limited to 'ops/posix_mq.rs/src/tests.rs')
-rw-r--r-- | ops/posix_mq.rs/src/tests.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ops/posix_mq.rs/src/tests.rs b/ops/posix_mq.rs/src/tests.rs new file mode 100644 index 000000000000..1f4ea9a58da6 --- /dev/null +++ b/ops/posix_mq.rs/src/tests.rs @@ -0,0 +1,21 @@ +use super::*; + +#[test] +fn test_open_delete() { + // Simple test with default queue settings + let name = Name::new("/test-queue").unwrap(); + let queue = Queue::open_or_create(name).expect("Opening queue failed"); + + let message = Message { + data: "test-message".as_bytes().to_vec(), + priority: 0, + }; + + queue.send(&message).expect("message sending failed"); + + let result = queue.receive().expect("message receiving failed"); + + assert_eq!(message, result); + + queue.delete().expect("deleting queue failed"); +} |