1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Fix the windows failure

by not using slashes in symlink targets.
This commit is contained in:
Shinichiro Hamaji 2017-04-11 12:02:26 +09:00
parent d556c9e398
commit 8f58a4a58a

View file

@ -1,4 +1,5 @@
use common::util::*;
use std::path::PathBuf;
#[test]
fn test_symlink_existing_file() {
@ -335,16 +336,20 @@ fn test_symlink_target_only() {
fn test_symlink_implicit_target_dir() {
let (at, mut ucmd) = at_and_ucmd!();
let dir = "test_symlink_implicit_target_dir";
let file = "test_symlink_implicit_target_dir/file";
// On windows, slashes aren't allowed in symlink targets, so use
// PathBuf to construct `file` instead of simple "dir/file".
let filename = "test_symlink_implicit_target_file";
let path = PathBuf::from(dir).join(filename);
let file = &path.to_string_lossy();
at.mkdir(dir);
at.touch(file);
ucmd.args(&["-s", file]).succeeds().no_stderr();
assert!(at.file_exists("file"));
assert!(at.is_symlink("file"));
assert_eq!(at.resolve_link("file"), file);
assert!(at.file_exists(filename));
assert!(at.is_symlink(filename));
assert_eq!(at.resolve_link(filename), *file);
}
#[test]