fix compile error on Windows

pull/120/head
Takayuki Maeda 3 years ago
parent 855935708c
commit cdc31c369c

@ -333,28 +333,28 @@ mod test {
#[test] #[test]
#[cfg(windows)] #[cfg(windows)]
fn test_expand_path() { fn test_expand_patha() {
let home = std::env::var("APPDATA").unwrap(); let home = std::env::var("APPDATA").unwrap();
let test_env = "baz"; let test_env = "baz";
env::set_var("TEST", test_env); env::set_var("TEST", test_env);
assert_eq!( assert_eq!(
expand_path(Path::new("%APPDATA%/foo").to_path_buf()), expand_path(&Path::new("%APPDATA%/foo")),
Some(PathBuf::from(home).join("foo")) Some(PathBuf::from(&home).join("foo"))
); );
assert_eq!( assert_eq!(
expand_path(Path::new("%APPDATA%/foo/%TEST%/bar").to_path_buf()), expand_path(&Path::new("%APPDATA%/foo/%TEST%/bar")),
Some(PathBuf::from(&home).join("foo").join(test_env).join("bar")) Some(PathBuf::from(&home).join("foo").join(test_env).join("bar"))
); );
assert_eq!( assert_eq!(
expand_path(Path::new("~/foo").to_path_buf()), expand_path(&Path::new("~/foo")),
Some(PathBuf::from(&home).join("foo")) Some(PathBuf::from(&home).join("foo"))
); );
assert_eq!( assert_eq!(
expand_path(Path::new("~/foo/~/bar").to_path_buf()), expand_path(&Path::new("~/foo/~/bar")),
Some(PathBuf::from(&home).join("foo").join("~").join("bar")) Some(PathBuf::from(&home).join("foo").join("~").join("bar"))
); );
} }

Loading…
Cancel
Save