]> git.lizzy.rs Git - rust.git/blob - library/std/src/sys_common/net/tests.rs
Sync core::simd up to rust-lang/portable-simd@2e081db92aa3ee0a4563bc28ce01bdad5b1b2efd
[rust.git] / library / std / src / sys_common / net / tests.rs
1 use super::*;
2 use crate::collections::HashMap;
3
4 #[test]
5 fn no_lookup_host_duplicates() {
6     let mut addrs = HashMap::new();
7     let lh = match LookupHost::try_from(("localhost", 0)) {
8         Ok(lh) => lh,
9         Err(e) => panic!("couldn't resolve `localhost': {e}"),
10     };
11     for sa in lh {
12         *addrs.entry(sa).or_insert(0) += 1;
13     }
14     assert_eq!(
15         addrs.iter().filter(|&(_, &v)| v > 1).collect::<Vec<_>>(),
16         vec![],
17         "There should be no duplicate localhost entries"
18     );
19 }