mirror of
https://github.com/sharkdp/fd.git
synced 2024-09-19 00:41:29 +02:00
Fix test on windows
This commit is contained in:
parent
609f1adf90
commit
d8d2c37ec0
@ -65,16 +65,23 @@ const fn host() -> &'static str {
|
|||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
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]
|
#[test]
|
||||||
fn test_unicode_encoding() {
|
fn test_unicode_encoding() {
|
||||||
let path: PathBuf = "/$*\x1bßé/∫😃".into();
|
|
||||||
let url = PathUrl::new(&path).unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
url.to_string(),
|
Encoded("$*\x1bßé/∫😃").to_string(),
|
||||||
format!(
|
"%24%2A%1B%C3%9F%C3%A9/%E2%88%AB%F0%9F%98%83",
|
||||||
"file://{}/%24%2A%1B%C3%9F%C3%A9/%E2%88%AB%F0%9F%98%83",
|
|
||||||
host()
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user