We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0500fbf commit 3038013Copy full SHA for 3038013
src/libstd/net/udp.rs
@@ -883,11 +883,23 @@ mod tests {
883
884
#[test]
885
fn set_nonblocking() {
886
- let addr = next_test_ip4();
+ each_ip(&mut |addr, _| {
887
+ let socket = t!(UdpSocket::bind(&addr));
888
- let stream = t!(UdpSocket::bind(&addr));
889
+ t!(socket.set_nonblocking(true));
890
+ t!(socket.set_nonblocking(false));
891
+
892
+ t!(socket.connect(addr));
893
- t!(stream.set_nonblocking(true));
- t!(stream.set_nonblocking(false));
894
895
896
897
+ let mut buf = [0];
898
+ match socket.recv(&mut buf) {
899
+ Ok(_) => panic!("expected error"),
900
+ Err(ref e) if e.kind() == ErrorKind::WouldBlock => {}
901
+ Err(e) => panic!("unexpected error {}", e),
902
+ }
903
+ })
904
}
905
0 commit comments