parent
ddbb27a241
commit
bd1cf04ca7
@ -1451,6 +1451,9 @@ mod tests {
|
|||||||
// two double colons
|
// two double colons
|
||||||
let none: Option<Ipv6Addr> = "1:2::6::8".parse().ok();
|
let none: Option<Ipv6Addr> = "1:2::6::8".parse().ok();
|
||||||
assert_eq!(None, none);
|
assert_eq!(None, none);
|
||||||
|
// `::` indicating zero groups of zeros
|
||||||
|
let none: Option<Ipv6Addr> = "1:2:3:4::5:6:7:8".parse().ok();
|
||||||
|
assert_eq!(None, none);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -246,7 +246,9 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut tail = [0; 8];
|
let mut tail = [0; 8];
|
||||||
let (tail_size, _) = read_groups(self, &mut tail, 8 - head_size);
|
// `::` indicates one or more groups of 16 bits of zeros
|
||||||
|
let limit = 8 - (head_size + 1);
|
||||||
|
let (tail_size, _) = read_groups(self, &mut tail, limit);
|
||||||
Some(ipv6_addr_from_head_tail(&head[..head_size], &tail[..tail_size]))
|
Some(ipv6_addr_from_head_tail(&head[..head_size], &tail[..tail_size]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user