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:
parent
d556c9e398
commit
8f58a4a58a
1 changed files with 9 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
use common::util::*;
|
use common::util::*;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_symlink_existing_file() {
|
fn test_symlink_existing_file() {
|
||||||
|
@ -335,16 +336,20 @@ fn test_symlink_target_only() {
|
||||||
fn test_symlink_implicit_target_dir() {
|
fn test_symlink_implicit_target_dir() {
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
let dir = "test_symlink_implicit_target_dir";
|
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.mkdir(dir);
|
||||||
at.touch(file);
|
at.touch(file);
|
||||||
|
|
||||||
ucmd.args(&["-s", file]).succeeds().no_stderr();
|
ucmd.args(&["-s", file]).succeeds().no_stderr();
|
||||||
|
|
||||||
assert!(at.file_exists("file"));
|
assert!(at.file_exists(filename));
|
||||||
assert!(at.is_symlink("file"));
|
assert!(at.is_symlink(filename));
|
||||||
assert_eq!(at.resolve_link("file"), file);
|
assert_eq!(at.resolve_link(filename), *file);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue