@@ -2,9 +2,9 @@ use bstr::{BString, ByteSlice};
2
2
use gix_url:: { parse, Url } ;
3
3
#[ test]
4
4
fn scp_like_keeps_username_literal_no_percent_encoding ( ) {
5
+ // scp-like keeps username literal in alternative form
5
6
let cases = [
6
7
( "[email protected] :org/repo.git" , "john+doe" ) ,
7
- ( "foo%bar@host:repo/path" , "foo%bar" ) ,
8
8
( "user.name@host:repo" , "user.name" ) ,
9
9
( "u_ser-123@host:org/repo" , "u_ser-123" ) ,
10
10
] ;
@@ -19,11 +19,13 @@ fn scp_like_keeps_username_literal_no_percent_encoding() {
19
19
20
20
#[ test]
21
21
fn ssh_scheme_behavior_unchanged ( ) {
22
+ // ssh:// round-trips with canonical form percent encoding
22
23
let input =
"ssh://[email protected] /org/repo.git" ;
24
+ let expected_output =
"ssh://john%[email protected] /org/repo.git" ;
23
25
let url = gix_url:: parse ( input. as_bytes ( ) . as_bstr ( ) ) . expect ( "parse ssh://" ) ;
24
26
assert_eq ! (
25
27
url. to_bstring( ) . as_bstr( ) ,
26
- input . as_bytes( ) . as_bstr( ) ,
27
- "ssh:// round-trip changed ( should remain consistent) "
28
+ expected_output . as_bytes( ) . as_bstr( ) ,
29
+ "ssh:// canonical form should percent-encode special chars "
28
30
) ;
29
31
}
0 commit comments