From 38242194b63b362ca5385b9e40019db007a8048f Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 2 Feb 2024 11:50:10 +0100 Subject: [PATCH] tests: Add a test that explicitly sets the local address --- src/socket/udp.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/socket/udp.rs b/src/socket/udp.rs index 6f39aa4bc..269043ef7 100644 --- a/src/socket/udp.rs +++ b/src/socket/udp.rs @@ -743,6 +743,17 @@ mod test { assert_eq!(socket.send_slice(b"abcdef", REMOTE_END), Ok(())); } + #[test] + fn test_send_with_source() { + let mut socket = socket(buffer(0), buffer(1)); + + assert_eq!(socket.bind(LOCAL_PORT), Ok(())); + assert_eq!( + socket.send_slice(b"abcdef", remote_metadata_with_local()), + Ok(()) + ); + } + #[rstest] #[case::ip(Medium::Ip)] #[cfg(feature = "medium-ip")]