File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-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,17 @@ 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 = {
486
+ let vfn = |s : & str | violation. set ( Some ( s. to_owned ( ) ) ) ;
487
+ let options = Url :: options ( ) . log_syntax_violation ( Some ( & vfn) ) ;
488
+ options. parse ( "http:////mozilla.org:42" ) . unwrap ( )
489
+ } ;
490
+ assert_eq ! ( url. port( ) , Some ( 42 ) ) ;
491
+
492
+ let violation = violation. take ( ) ;
493
+ assert_eq ! ( violation, Some ( "expected //" . to_string( ) ) ) ;
494
+ }
You can’t perform that action at this time.
0 commit comments