summaryrefslogtreecommitdiffstats
path: root/tests/integration.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration.rs')
-rw-r--r--tests/integration.rs23
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()
}