diff options
author | zwPapEr <zw.paper@gmail.com> | 2020-04-05 18:27:01 +0800 |
---|---|---|
committer | Abin Simon <abinsimon10@gmail.com> | 2020-04-07 12:25:11 +0530 |
commit | 645be4a668fad2d08e1017cdd0e995b3f808dd37 (patch) | |
tree | 306787fba79a7fb19071955c4c033a96ce0d4ef2 /tests | |
parent | ad25edcd7e5d1490394082af99ae94c0e42635b1 (diff) |
delete fs canonicalize for show broken softlink without error
fix https://github.com/Peltoche/lsd/issues/72
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/integration.rs b/tests/integration.rs index 05dfa95..8d38fc7 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -6,6 +6,9 @@ use assert_fs::prelude::*; use predicates::prelude::*; use std::process::Command; +#[cfg(unix)] +use std::os::unix::fs; + #[test] fn test_runs_okay() { cmd().assert().success(); @@ -134,6 +137,26 @@ fn test_list_inode_with_long_ok() { cmd().arg("-i").arg("-l").arg(dir.path()).assert().success(); } +#[cfg(unix)] +#[test] +fn test_list_broken_link_ok() { + let dir = tempdir(); + let broken_link = dir.path().join("broken-softlink"); + let matched = "No such file or directory"; + fs::symlink("not-existed-file", &broken_link).unwrap(); + + cmd() + .arg(&broken_link) + .assert() + .stderr(predicate::str::contains(matched).not()); + + cmd() + .arg("-l") + .arg(broken_link) + .assert() + .stderr(predicate::str::contains(matched).not()); +} + fn cmd() -> Command { Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap() } |