diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-06-14 11:27:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-14 11:27:10 +0200 |
| commit | 8f90d0565792f722249742bc6963b782785a5e3c (patch) | |
| tree | ad94a8f68ae9a3eaedc56d882d136b4797ee3606 /library/std/src/os/unix/net/tests.rs | |
| parent | 9bdf5d371f01dcfca2122acc6a9d2dfb8a23b089 (diff) | |
| parent | ded2afcb2330d6c0ff078a985f26d8f5845f229a (diff) | |
| download | rust-8f90d0565792f722249742bc6963b782785a5e3c.tar.gz rust-8f90d0565792f722249742bc6963b782785a5e3c.zip | |
Rollup merge of #141493 - tamird:addreskind-bytestr, r=joshtriplett
Delegate `<SocketAddr as Debug>` to `ByteStr` This allows UTF-8 characters to be printed without escapes, rather than just ASCII. r? ``@joshtriplett``
Diffstat (limited to 'library/std/src/os/unix/net/tests.rs')
| -rw-r--r-- | library/std/src/os/unix/net/tests.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/library/std/src/os/unix/net/tests.rs b/library/std/src/os/unix/net/tests.rs index 0398a535eb5..9a88687b1df 100644 --- a/library/std/src/os/unix/net/tests.rs +++ b/library/std/src/os/unix/net/tests.rs @@ -411,6 +411,15 @@ fn test_unix_datagram_timeout_zero_duration() { assert_eq!(err.kind(), ErrorKind::InvalidInput); } +#[cfg(any(target_os = "android", target_os = "linux"))] +#[test] +fn abstract_socket_addr_debug() { + assert_eq!( + r#""\0hello world\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x11\x12\r\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x7f\x80\x81\xfe\xff" (abstract)"#, + format!("{:?}", SocketAddr::from_abstract_name(b"\0hello world\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x11\x12\r\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f \x7f\x80\x81\xfe\xff").unwrap()), + ); +} + #[test] fn abstract_namespace_not_allowed_connect() { assert!(UnixStream::connect("\0asdf").is_err()); |
