| 1 | #![cfg(all(feature = "net", feature = "std"))] |
| 2 | |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::netrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/::{Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#, Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#, SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#, SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#}; |
| 4 | |
| 5 | use fluent_urirust-analyzer cargo fluent-uri 0.4.1 crate/::UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#; |
| 6 | |
| 7 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 8 | fn test_to_socket_addrsrust-analyzer cargo fluent-uri 0.4.1 test_to_socket_addrs().() { |
| 9 | let r = UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#::parserust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]parse().("//127.0.0.1:81").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 10 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(r |
| 11 | .authorityrust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]authority().() |
| 12 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 13 | .socket_addrsrust-analyzer cargo fluent-uri 0.4.1 component/impl#[`Authority<'a, UserinfoE, RegNameE>`]socket_addrs().(80) |
| 14 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 15 | .eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().([SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV4]new().(Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]new().(127, 0, 0, 1), 81).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()])); |
| 16 | |
| 17 | let r = UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#::parserust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]parse().("//127.0.0.1").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 18 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(r |
| 19 | .authorityrust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]authority().() |
| 20 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 21 | .socket_addrsrust-analyzer cargo fluent-uri 0.4.1 component/impl#[`Authority<'a, UserinfoE, RegNameE>`]socket_addrs().(80) |
| 22 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 23 | .eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().([SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV4]new().(Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]new().(127, 0, 0, 1), 80).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()])); |
| 24 | |
| 25 | let r = UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#::parserust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]parse().("//[::1]").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 26 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(r |
| 27 | .authorityrust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]authority().() |
| 28 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 29 | .socket_addrsrust-analyzer cargo fluent-uri 0.4.1 component/impl#[`Authority<'a, UserinfoE, RegNameE>`]socket_addrs().(80) |
| 30 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 31 | .eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().([SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV6]new().(Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr]new().(0, 0, 0, 0, 0, 0, 0, 1), 80, 0, 0).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()])); |
| 32 | |
| 33 | let r = UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#::parserust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]parse().("//127.0.0.1:").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 34 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(r |
| 35 | .authorityrust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]authority().() |
| 36 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 37 | .socket_addrsrust-analyzer cargo fluent-uri 0.4.1 component/impl#[`Authority<'a, UserinfoE, RegNameE>`]socket_addrs().(80) |
| 38 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 39 | .eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#eq().([SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV4]new().(Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]new().(127, 0, 0, 1), 80).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()])); |
| 40 | |
| 41 | let r = UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#::parserust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]parse().("//127.0.0.1:65537").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 42 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 43 | r.authorityrust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]authority().() |
| 44 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 45 | .socket_addrsrust-analyzer cargo fluent-uri 0.4.1 component/impl#[`Authority<'a, UserinfoE, RegNameE>`]socket_addrs().(80) |
| 46 | .errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]err().() |
| 47 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 48 | .to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 49 | "invalid port value" |
| 50 | ); |
| 51 | |
| 52 | let r = UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#::parserust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]parse().("//[vF.whatever]").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 53 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 54 | r.authorityrust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]authority().() |
| 55 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 56 | .socket_addrsrust-analyzer cargo fluent-uri 0.4.1 component/impl#[`Authority<'a, UserinfoE, RegNameE>`]socket_addrs().(80) |
| 57 | .errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]err().() |
| 58 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() |
| 59 | .to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 60 | "address mechanism not supported" |
| 61 | ); |
| 62 | } |