mirror of
https://github.com/lsd-rs/lsd.git
synced 2026-02-11 09:43:34 +02:00
delete fs canonicalize for show broken softlink without error
fix https://github.com/Peltoche/lsd/issues/72
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user