mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 05:27:45 +00:00
test/touch: fix tests for Windows and MacOS
This commit is contained in:
parent
7e1c6d1baf
commit
ca6b4ca7de
1 changed files with 12 additions and 6 deletions
|
@ -703,6 +703,8 @@ fn test_touch_leap_second() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
// File::create doesn't support trailing separator in Windows
|
||||||
fn test_touch_trailing_slash_no_create() {
|
fn test_touch_trailing_slash_no_create() {
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
at.touch("file");
|
at.touch("file");
|
||||||
|
@ -725,12 +727,16 @@ fn test_touch_trailing_slash_no_create() {
|
||||||
ucmd.args(&["-c", "loop/"]).fails().code_is(1);
|
ucmd.args(&["-c", "loop/"]).fails().code_is(1);
|
||||||
assert!(!at.file_exists("loop"));
|
assert!(!at.file_exists("loop"));
|
||||||
|
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
#[cfg(not(target_os = "macos"))]
|
||||||
at.touch("file2");
|
// MacOS supports trailing slash for symlinks to files
|
||||||
at.relative_symlink_file("file2", "link1");
|
{
|
||||||
ucmd.args(&["-c", "link1/"]).fails().code_is(1);
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
assert!(at.file_exists("file2"));
|
at.touch("file2");
|
||||||
assert!(at.symlink_exists("link1"));
|
at.relative_symlink_file("file2", "link1");
|
||||||
|
ucmd.args(&["-c", "link1/"]).fails().code_is(1);
|
||||||
|
assert!(at.file_exists("file2"));
|
||||||
|
assert!(at.symlink_exists("link1"));
|
||||||
|
}
|
||||||
|
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
at.mkdir("dir");
|
at.mkdir("dir");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue