File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ extern crate url;
13
13
14
14
use std:: ascii:: AsciiExt ;
15
15
use std:: borrow:: Cow ;
16
+ use std:: cell:: Cell ;
16
17
use std:: net:: { Ipv4Addr , Ipv6Addr } ;
17
18
use std:: path:: { Path , PathBuf } ;
18
19
use url:: { Host , HostAndPort , Url , form_urlencoded} ;
@@ -477,3 +478,15 @@ fn test_windows_unc_path() {
477
478
let url = Url :: from_file_path ( Path :: new ( r"\\.\some\path\file.txt" ) ) ;
478
479
assert ! ( url. is_err( ) ) ;
479
480
}
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