about summary refs log tree commit diff
path: root/ops/posix_mq.rs/src/tests.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-01-20T11·32+0000
committerVincent Ambo <tazjin@google.com>2020-01-20T11·32+0000
commitb59c7e693c21cf76619ad89ae008d92ebbb92dad (patch)
treef69699cd9071832f03001af5511788b2159f04c1 /ops/posix_mq.rs/src/tests.rs
parent8f684972695aeb64d1c09499bb14c5cd65bafd91 (diff)
parentf7d1a38da67e92e0e87dbb988d288f0be2714f5c (diff)
Add 'ops/posix_mq.rs/' from commit 'f7d1a38da67e92e0e87dbb988d288f0be2714f5c' r/429
git-subtree-dir: ops/posix_mq.rs
git-subtree-mainline: 8f684972695aeb64d1c09499bb14c5cd65bafd91
git-subtree-split: f7d1a38da67e92e0e87dbb988d288f0be2714f5c
Diffstat (limited to 'ops/posix_mq.rs/src/tests.rs')
-rw-r--r--ops/posix_mq.rs/src/tests.rs22
1 files changed, 22 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..0018e40dacd3
--- /dev/null
+++ b/ops/posix_mq.rs/src/tests.rs
@@ -0,0 +1,22 @@
+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();
+}