summary refs log tree commit diff
path: root/msg_socket2/tests/option.rs
blob: 130dd7d567a4ffdad210881bc092a7d00ac31f56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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()));
}