From 86b52f76265a300a4a2ea27fc8fcea4de5f4f31d Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 12 Dec 2022 14:54:11 +1000 Subject: [PATCH] Add a small unit test pct-str encoded the / character as well, but the difference shouldn't matter in our case. --- rslib/src/text.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rslib/src/text.rs b/rslib/src/text.rs index 6ae2b03c1..07675a127 100644 --- a/rslib/src/text.rs +++ b/rslib/src/text.rs @@ -622,4 +622,21 @@ mod test { truncate_to_char_boundary(&mut s, 1); assert_eq!(&s, ""); } + + #[test] + fn iri_encoding() { + for (input, output) in [ + ("foo.jpg", "foo.jpg"), + ("bar baz", "bar%20baz"), + ("sub/path.jpg", "sub/path.jpg"), + ("日本語", "日本語"), + ("a=b", "a=b"), + ("a&b", "a&b"), + ] { + assert_eq!( + &encode_iri_paths(&format!("")), + &format!("") + ); + } + } }