Skip to content

Commit 4eda40f

Browse files
committed
Verify port in test. Ensures endianness is correct
1 parent 3018422 commit 4eda40f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/all.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ macro_rules! t {
1616
#[test]
1717
fn smoke_build_listener() {
1818
let b = t!(TcpBuilder::new_v4());
19-
t!(b.bind("127.0.0.1:0"));
19+
t!(b.bind("127.0.0.1:6543"));
2020

2121
let addr = t!(b.local_addr());
2222
assert_eq!(addr.ip(), IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)));
23+
assert_eq!(addr.port(), 6543);
2324

2425
let listener = t!(b.listen(200));
2526

@@ -38,8 +39,9 @@ fn smoke_build_listener() {
3839
#[test]
3940
fn smoke_build_listener_v6() {
4041
let b = t!(TcpBuilder::new_v6());
41-
t!(b.bind("::1:0"));
42+
t!(b.bind("::1:1234"));
4243

4344
let addr = t!(b.local_addr());
4445
assert_eq!(addr.ip(), IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)));
46+
assert_eq!(addr.port(), 1234)
4547
}

0 commit comments

Comments
 (0)