Skip to content

Commit

Permalink
Add test for comparing SocketAddr with inferred right-hand side
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jun 13, 2020
1 parent c45231c commit 204c236
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libstd/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit 204c236

Please sign in to comment.