diff options
Diffstat (limited to 'msg_socket2/tests/option.rs')
-rw-r--r-- | msg_socket2/tests/option.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/msg_socket2/tests/option.rs b/msg_socket2/tests/option.rs new file mode 100644 index 0000000..130dd7d --- /dev/null +++ b/msg_socket2/tests/option.rs @@ -0,0 +1,12 @@ +use msg_socket2::Socket; +use sys_util::net::UnixSeqpacket; + +#[test] +fn option() { + let (f1, f2) = UnixSeqpacket::pair().unwrap(); + let s1: Socket<_, ()> = Socket::new(f1); + let s2: Socket<(), Option<String>> = Socket::new(f2); + + s1.send(Some("hello world".to_string())).unwrap(); + assert_eq!(s2.recv().unwrap(), Some("hello world".to_string())); +} |