File tree 1 file changed +6
-8
lines changed
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -511,21 +511,19 @@ mod endpoint_tests {
511
511
512
512
#[ test]
513
513
fn convert_to_socket_addrs ( ) {
514
- let endpoint = HttpEndpoint :: for_host ( "foo.com " . into ( ) ) ;
514
+ let endpoint = HttpEndpoint :: for_host ( "localhost " . into ( ) ) ;
515
515
let host = endpoint. host ( ) ;
516
516
let port = endpoint. port ( ) ;
517
517
518
518
use std:: net:: ToSocketAddrs ;
519
519
match ( & endpoint) . to_socket_addrs ( ) {
520
520
Err ( e) => panic ! ( "Unexpected error: {:?}" , e) ,
521
- Ok ( mut socket_addrs) => {
522
- match socket_addrs. next ( ) {
523
- None => panic ! ( "Expected socket address" ) ,
524
- Some ( addr) => {
525
- assert_eq ! ( addr, ( host, port) . to_socket_addrs( ) . unwrap( ) . next( ) . unwrap( ) ) ;
526
- assert ! ( socket_addrs. next( ) . is_none( ) ) ;
527
- }
521
+ Ok ( socket_addrs) => {
522
+ let mut std_addrs = ( host, port) . to_socket_addrs ( ) . unwrap ( ) ;
523
+ for addr in socket_addrs {
524
+ assert_eq ! ( addr, std_addrs. next( ) . unwrap( ) ) ;
528
525
}
526
+ assert ! ( std_addrs. next( ) . is_none( ) ) ;
529
527
}
530
528
}
531
529
}
You can’t perform that action at this time.
0 commit comments