mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-16 00:48:28 +01:00
Fix test on windows
This commit is contained in:
parent
609f1adf90
commit
d8d2c37ec0
1 changed files with 14 additions and 7 deletions
|
@ -65,16 +65,23 @@ const fn host() -> &'static str {
|
|||
mod test {
|
||||
use super::*;
|
||||
|
||||
// This allows us to test the encoding without having to worry about the host, or absolute path
|
||||
struct Encoded(&'static str);
|
||||
|
||||
impl fmt::Display for Encoded {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
for byte in self.0.bytes() {
|
||||
encode(f, byte)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unicode_encoding() {
|
||||
let path: PathBuf = "/$*\x1bßé/∫😃".into();
|
||||
let url = PathUrl::new(&path).unwrap();
|
||||
assert_eq!(
|
||||
url.to_string(),
|
||||
format!(
|
||||
"file://{}/%24%2A%1B%C3%9F%C3%A9/%E2%88%AB%F0%9F%98%83",
|
||||
host()
|
||||
),
|
||||
Encoded("$*\x1bßé/∫😃").to_string(),
|
||||
"%24%2A%1B%C3%9F%C3%A9/%E2%88%AB%F0%9F%98%83",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue