Skip to content

Commit 7cabaa6

Browse files
dtolnayMark-Simulacrum
authored andcommitted
Add test for comparing SocketAddr with inferred right-hand side
1 parent b7dc83a commit 7cabaa6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libstd/net/addr.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,5 +1268,10 @@ mod tests {
12681268
assert!(v6_1 < v6_3);
12691269
assert!(v4_3 > v4_1);
12701270
assert!(v6_3 > v6_1);
1271+
1272+
// compare with an inferred right-hand side
1273+
assert_eq!(v4_1, "224.120.45.1:23456".parse().unwrap());
1274+
assert_eq!(v6_1, "[2001:db8:f00::1002]:23456".parse().unwrap());
1275+
assert_eq!(SocketAddr::V4(v4_1), "224.120.45.1:23456".parse().unwrap());
12711276
}
12721277
}

0 commit comments

Comments
 (0)