File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ extern crate url;
1313
1414use std:: ascii:: AsciiExt ;
1515use std:: borrow:: Cow ;
16+ use std:: cell:: Cell ;
1617use std:: net:: { Ipv4Addr , Ipv6Addr } ;
1718use std:: path:: { Path , PathBuf } ;
1819use url:: { Host , HostAndPort , Url , form_urlencoded} ;
@@ -477,3 +478,15 @@ fn test_windows_unc_path() {
477478 let url = Url :: from_file_path ( Path :: new ( r"\\.\some\path\file.txt" ) ) ;
478479 assert ! ( url. is_err( ) ) ;
479480}
481+
482+ #[ test]
483+ fn test_old_log_violation_option ( ) {
484+ let violation = Cell :: new ( None ) ;
485+ let url = Url :: options ( )
486+ . log_syntax_violation ( Some ( & |s| violation. set ( Some ( s. to_owned ( ) ) ) ) )
487+ . parse ( "http:////mozilla.org:42" ) . unwrap ( ) ;
488+ assert_eq ! ( url. port( ) , Some ( 42 ) ) ;
489+
490+ let violation = violation. take ( ) ;
491+ assert_eq ! ( violation, Some ( "expected //" . to_string( ) ) ) ;
492+ }
You can’t perform that action at this time.
0 commit comments