Check against specific errors in parsing test

This commit is contained in:
Abhishek Chanda
2020-01-05 11:36:49 +00:00
parent f3ac9ba3fe
commit 986ee0ba1c
2 changed files with 7 additions and 2 deletions

View File

@ -484,8 +484,8 @@ mod test {
}
#[test]
fn parse_netmask_broken() {
"192.168.1.0/255.0.255.0".parse::<Ipv4Network>().unwrap_err();
fn parse_netmask_broken_v4() {
assert_eq!("192.168.1.0/255.0.255.0".parse::<Ipv4Network>(), Err(IpNetworkError::InvalidPrefix));
}
#[test]

View File

@ -309,6 +309,11 @@ mod test {
assert_eq!(cidr.prefix(), 24);
}
#[test]
fn parse_netmask_broken_v6() {
assert_eq!("FF01:0:0:17:0:0:0:2/255.255.255.0".parse::<Ipv6Network>(), Err(IpNetworkError::InvalidPrefix));
}
#[test]
fn create_v6_invalid_prefix() {
let cidr = Ipv6Network::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 129);