fix test for is_hostname_port_str
This commit is contained in:
parent
f10f969c2c
commit
12d446b217
@ -347,19 +347,20 @@ mod test_lib {
|
|||||||
assert_eq!(is_ipv6_str("[1:2::0]:"), false);
|
assert_eq!(is_ipv6_str("[1:2::0]:"), false);
|
||||||
assert_eq!(is_ipv6_str("1:2::0]:1"), false);
|
assert_eq!(is_ipv6_str("1:2::0]:1"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hostname_port() {
|
fn test_hostname_port() {
|
||||||
assert_eq!(is_ipv6_str("a:12"), true);
|
assert_eq!(is_hostname_port_str("a:12"), true);
|
||||||
assert_eq!(is_ipv6_str("a.b.c:12"), true);
|
assert_eq!(is_hostname_port_str("a.b.c:12"), true);
|
||||||
assert_eq!(is_ipv6_str("test.com:12"), true);
|
assert_eq!(is_hostname_port_str("test.com:12"), true);
|
||||||
assert_eq!(is_ipv6_str("1.2.3:12"), true);
|
assert_eq!(is_hostname_port_str("1.2.3:12"), true);
|
||||||
assert_eq!(is_ipv6_str("a.b.c:123456"), false);
|
assert_eq!(is_hostname_port_str("a.b.c:123456"), false);
|
||||||
// todo: should we also check for these edge case?
|
// todo: should we also check for these edge case?
|
||||||
// out-of-range port
|
// out-of-range port
|
||||||
assert_eq!(is_ipv6_str("test.com:0"), true);
|
assert_eq!(is_hostname_port_str("test.com:0"), true);
|
||||||
assert_eq!(is_ipv6_str("test.com:98989"), true);
|
assert_eq!(is_hostname_port_str("test.com:98989"), true);
|
||||||
// invalid hostname
|
// invalid hostname
|
||||||
assert_eq!(is_ipv6_str("---:12"), true);
|
assert_eq!(is_hostname_port_str("---:12"), true);
|
||||||
assert_eq!(is_ipv6_str(".:12"), true);
|
assert_eq!(is_hostname_port_str(".:12"), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user