File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1392,3 +1392,25 @@ fn test_parse_url_with_single_byte_control_host() {
13921392 let url2 = Url :: parse ( url1. as_str ( ) ) . unwrap ( ) ;
13931393 assert_eq ! ( url2, url1) ;
13941394}
1395+
1396+ #[ test]
1397+ fn magnet_roundtrip_parse ( ) {
1398+ let url = Url :: parse ( "magnet:?xt=urn:btmh:foo" ) . unwrap ( ) ;
1399+ assert_eq ! ( url. as_str( ) , "magnet:?xt=urn:btmh:foo" ) ;
1400+ }
1401+
1402+ #[ test]
1403+ fn magnet_roundtrip_append_pair ( ) {
1404+ let mut url = Url :: parse ( "magnet:" ) . unwrap ( ) ;
1405+ {
1406+ let mut query_pairs = url. query_pairs_mut ( ) ;
1407+ query_pairs. append_pair ( "xt" , "urn:btmh:foo" ) ;
1408+ }
1409+ assert_eq ! ( url. as_str( ) , "magnet:?xt=urn:btmh:foo" ) ;
1410+ }
1411+
1412+ #[ test]
1413+ fn magnet_roundtrip_parse_with_params ( ) {
1414+ let url = Url :: parse_with_params ( "magnet:" , vec ! [ ( "xt" , "urn:btmh:foo" ) ] ) . unwrap ( ) ;
1415+ assert_eq ! ( url. as_str( ) , "magnet:?xt=urn:btmh:foo" ) ;
1416+ }
You can’t perform that action at this time.
0 commit comments