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 @@ -30,6 +30,28 @@ mod canonicalized {
30
30
}
31
31
}
32
32
33
+ #[ test]
34
+ fn password ( ) -> crate :: Result {
35
+ let mut url = gix_url:: parse ( "https://user:password@host/path" . into ( ) ) ?;
36
+
37
+ assert_eq ! ( url. password( ) , Some ( "password" ) ) ;
38
+ assert_eq ! ( url. set_password( Some ( "new-pass" . into( ) ) ) , Some ( "password" . into( ) ) ) ;
39
+ assert_eq ! ( url. password( ) , Some ( "new-pass" ) ) ;
40
+
41
+ Ok ( ( ) )
42
+ }
43
+
44
+ #[ test]
45
+ fn user ( ) -> crate :: Result {
46
+ let mut url = gix_url:: parse ( "https://user:password@host/path" . into ( ) ) ?;
47
+
48
+ assert_eq ! ( url. user( ) , Some ( "user" ) ) ;
49
+ assert_eq ! ( url. set_user( Some ( "new-user" . into( ) ) ) , Some ( "user" . into( ) ) ) ;
50
+ assert_eq ! ( url. user( ) , Some ( "new-user" ) ) ;
51
+
52
+ Ok ( ( ) )
53
+ }
54
+
33
55
#[ test]
34
56
fn host_argument_safe ( ) -> crate :: Result {
35
57
let url = gix_url:: parse ( "ssh://-oProxyCommand=open$IFS-aCalculator/foo" . into ( ) ) ?;
You can’t perform that action at this time.
0 commit comments