Debian Codegraph @

tests/parse_ip.rs

raw symbols SCIP
1 #![cfg(feature = "net")]
2
3 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::netrust-analyzer cargo core https://github.com/rust-lang/rust/library/core 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#};
4
5 use fluent_urirust-analyzer cargo fluent-uri 0.4.1 crate/::{componentrust-analyzer cargo fluent-uri 0.4.1 component/::Hostrust-analyzer cargo fluent-uri 0.4.1 component/Host#, UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#};
6
7 fn parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().(s: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#> {
8 let s = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("//{s}");
9 match UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#::parserust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]parse().(&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Deref]deref().s).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..authorityrust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]authority().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..host_parsedrust-analyzer cargo fluent-uri 0.4.1 component/impl#[`Authority<'a, UserinfoE, RegNameE>`]host_parsed().() {
10 Hostrust-analyzer cargo fluent-uri 0.4.1 component/Host#::Ipv4rust-analyzer cargo fluent-uri 0.4.1 component/Host#Ipv4#(addr) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(addr),
11 _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
12 }
13 }
14
15 fn parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().(s: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#> {
16 let s = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("//[{s}]");
17 match UriRefrust-analyzer cargo fluent-uri 0.4.1 imp/UriRef#::parserust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]parse().(&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Deref]deref().s).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..authorityrust-analyzer cargo fluent-uri 0.4.1 imp/impl#[`UriRef<T>`]authority().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..host_parsedrust-analyzer cargo fluent-uri 0.4.1 component/impl#[`Authority<'a, UserinfoE, RegNameE>`]host_parsed().() {
18 Hostrust-analyzer cargo fluent-uri 0.4.1 component/Host#::Ipv6rust-analyzer cargo fluent-uri 0.4.1 component/Host#Ipv6#(addr) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(addr),
19 _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
20 }
21 }
22
23 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
24 fn test_parse_v4rust-analyzer cargo fluent-uri 0.4.1 test_parse_v4().() {
25 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("127.0.0.1"));
26 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
27 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(255, 255, 255, 255)),
28 parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("255.255.255.255")
29 );
30 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(0, 0, 0, 0)), parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("0.0.0.0"));
31
32 // out of range
33 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("256.0.0.1").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
34 // too short
35 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("255.0.0").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
36 // too long
37 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("255.0.0.1.2").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
38 // no number between dots
39 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("255.0..1").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
40 // octal
41 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("255.0.0.01").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
42 // octal zero
43 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("255.0.0.00").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
44 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("255.0.00.0").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
45 // leading dot
46 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().(".0.0.0.0").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
47 // trailing dot
48 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v4rust-analyzer cargo fluent-uri 0.4.1 parse_v4().("0.0.0.0.").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
49 }
50
51 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
52 fn test_parse_v6rust-analyzer cargo fluent-uri 0.4.1 test_parse_v6().() {
53 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
54 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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, 0)),
55 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("0:0:0:0:0:0:0:0")
56 );
57 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
58 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(1, 2, 3, 4, 5, 6, 7, 8)),
59 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:02:003:0004:0005:006:07:8")
60 );
61
62 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::1"));
63 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(1, 0, 0, 0, 0, 0, 0, 0)), parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1::"));
64 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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, 0)), parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::"));
65
66 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
67 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(0x2a02, 0x6b8, 0, 0, 0, 0, 0x11, 0x11)),
68 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("2a02:6b8::11:11")
69 );
70
71 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
72 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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, 2, 3, 4, 5, 6, 7, 8)),
73 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::2:3:4:5:6:7:8")
74 );
75 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
76 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(1, 2, 3, 4, 0, 6, 7, 8)),
77 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:3:4::6:7:8")
78 );
79 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
80 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(1, 2, 3, 4, 5, 6, 7, 0)),
81 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:3:4:5:6:7::")
82 );
83
84 // only a colon
85 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().(":").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
86 // too long group
87 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::00000").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
88 // too short
89 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:3:4:5:6:7").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
90 // too long
91 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:3:4:5:6:7:8:9").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
92 // triple colon
93 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:::6:7:8").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
94 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:::").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
95 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().(":::6:7:8").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
96 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().(":::").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
97 // two double colons
98 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2::6::8").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
99 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::6::8").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
100 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2::6::").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
101 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::2:6::").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
102 // `::` indicating zero groups of zeros
103 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::1:2:3:4:5:6:7:8").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
104 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:3:4::5:6:7:8").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
105 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:3:4:5:6:7:8::").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
106 // leading colon
107 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().(":1:2:3:4:5:6:7:8").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
108 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().(":1::1").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
109 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().(":1").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
110 // trailing colon
111 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:3:4:5:6:7:8:").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
112 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1::1:").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
113 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
114 }
115
116 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
117 fn test_parse_v4_in_v6rust-analyzer cargo fluent-uri 0.4.1 test_parse_v4_in_v6().() {
118 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
119 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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, 49152, 545)),
120 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::192.0.2.33")
121 );
122 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
123 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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, 0xFFFF, 49152, 545)),
124 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::FFFF:192.0.2.33")
125 );
126 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
127 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(0x64, 0xff9b, 0, 0, 0, 0, 49152, 545)),
128 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("64:ff9b::192.0.2.33")
129 );
130 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
131 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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().(
132 0x2001, 0xdb8, 0x122, 0xc000, 0x2, 0x2100, 49152, 545
133 )),
134 parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("2001:db8:122:c000:2:2100:192.0.2.33")
135 );
136
137 // colon after v4
138 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::127.0.0.1:").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
139 // not enough groups
140 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:3:4:5:127.0.0.1").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
141 // too many groups
142 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("1:2:3:4:5:6:7:127.0.0.1").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
143 // triple colons before v4
144 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().(":::4.4.4.4").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
145 // no colon before v4
146 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parse_v6rust-analyzer cargo fluent-uri 0.4.1 parse_v6().("::ffff4.4.4.4").is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
147 }