Add test for comparing SocketAddr with inferred right-hand side

This commit is contained in:
David Tolnay 2020-06-13 10:21:11 -07:00
parent c45231ca55
commit 204c236ad5
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
1 changed files with 5 additions and 0 deletions

View File

@ -1228,5 +1228,10 @@ mod tests {
assert!(v6_1 < v6_3);
assert!(v4_3 > v4_1);
assert!(v6_3 > v6_1);
// compare with an inferred right-hand side
assert_eq!(v4_1, "224.120.45.1:23456".parse().unwrap());
assert_eq!(v6_1, "[2001:db8:f00::1002]:23456".parse().unwrap());
assert_eq!(SocketAddr::V4(v4_1), "224.120.45.1:23456".parse().unwrap());
}
}