test(utils): cover bracketed IPv6 zone host parsing (#3073)

This commit is contained in:
安正超
2026-05-24 11:18:56 +08:00
committed by GitHub
parent c9377161e4
commit 8be787387c
+9
View File
@@ -457,6 +457,15 @@ mod tests {
assert_eq!(host.port, None);
}
#[test]
fn parse_host_with_bracketed_ipv6_zone_and_port() {
let result = parse_host("[fe80::1%eth0]:9000");
assert!(result.is_ok());
let host = result.unwrap();
assert_eq!(host.name, "fe80::1%eth0");
assert_eq!(host.port, Some(9000));
}
#[test]
fn parse_host_with_bracketed_ipv6_without_port() {
let result = parse_host("[::1]");