auto merge of #10650 : andreasots/rust/ipv6-is-in-hex, r=alexcrichton

Without this the assert in <tt>rust_malloc_ip6_addr</tt> is triggered as it expects a correctly formatted IPv6 address.
This commit is contained in:
bors 2013-11-25 17:46:32 -08:00
commit ffaee0fd96
1 changed files with 2 additions and 1 deletions

View File

@ -41,7 +41,7 @@ impl ToStr for IpAddr {
}
Ipv6Addr(a, b, c, d, e, f, g, h) =>
format!("{}:{}:{}:{}:{}:{}:{}:{}", a, b, c, d, e, f, g, h)
format!("{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}:{:x}", a, b, c, d, e, f, g, h)
}
}
}
@ -449,6 +449,7 @@ mod test {
fn ipv6_addr_to_str() {
let a1 = Ipv6Addr(0, 0, 0, 0, 0, 0xffff, 0xc000, 0x280);
assert!(a1.to_str() == ~"::ffff:192.0.2.128" || a1.to_str() == ~"::FFFF:192.0.2.128");
assert_eq!(Ipv6Addr(8, 9, 10, 11, 12, 13, 14, 15).to_str(), ~"8:9:a:b:c:d:e:f");
}
}