Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6ca7e2

Browse files
committed
refactor
- add another test to be sure slashes are also handled as one would expect.
1 parent 32885f3 commit d6ca7e2

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

gix-url/tests/url/parse/http.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,16 @@ fn percent_encoded_international_path() -> crate::Result {
156156

157157
#[test]
158158
fn percent_encoded_path_roundtrips_in_lossless_serialization() -> crate::Result {
159-
let input = "https://%20@%40:example.org/%20%25";
160-
let url = gix_url::parse(input.into())?;
161-
let serialized = url.to_bstring();
162-
assert_eq!(serialized, input);
163-
assert_eq!(gix_url::parse(serialized.as_ref())?, url);
159+
for (input, expected_host, expected_path) in [
160+
("https://%20@%40:example.org/%20%25", "%40:example.org", "/ %"),
161+
("https://%20@%40:example.org/%20%25/%20%25", "%40:example.org", "/ %/ %"),
162+
] {
163+
let url = gix_url::parse(input.into())?;
164+
let serialized = url.to_bstring();
165+
assert_eq!(serialized, input);
166+
assert_eq!(url.host(), Some(expected_host));
167+
assert_eq!(url.path, expected_path);
168+
assert_eq!(gix_url::parse(serialized.as_ref())?, url);
169+
}
164170
Ok(())
165171
}

0 commit comments

Comments
 (0)