summaryrefslogtreecommitdiffstats
path: root/tests/integration.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration.rs')
-rw-r--r--tests/integration.rs53
1 files changed, 50 insertions, 3 deletions
diff --git a/tests/integration.rs b/tests/integration.rs
index d61487f..96ac61e 100644
--- a/tests/integration.rs
+++ b/tests/integration.rs
@@ -20,12 +20,33 @@ fn test_list_empty_directory() {
}
#[test]
+fn test_list_almost_all_empty_directory() {
+ cmd()
+ .arg("--almost-all")
+ .arg(tempdir().path())
+ .assert()
+ .stdout(predicate::eq(""));
+
+ cmd()
+ .arg("-A")
+ .arg(tempdir().path())
+ .assert()
+ .stdout(predicate::eq(""));
+}
+
+#[test]
fn test_list_all_empty_directory() {
cmd()
.arg("--all")
.arg(tempdir().path())
.assert()
- .stdout(predicate::eq(".\n..\n"));
+ .stdout(predicate::str::is_match(".* \\.\n.* \\.\\.\n$").unwrap());
+
+ cmd()
+ .arg("-a")
+ .arg(tempdir().path())
+ .assert()
+ .stdout(predicate::str::is_match(".* \\.\n.* \\.\\.\n$").unwrap());
}
#[test]
@@ -36,7 +57,19 @@ fn test_list_populated_directory() {
cmd()
.arg(dir.path())
.assert()
- .stdout(predicate::eq("one\ntwo\n"));
+ .stdout(predicate::str::is_match(".* one\n.* two\n$").unwrap());
+}
+
+#[test]
+fn test_list_almost_all_populated_directory() {
+ let dir = tempdir();
+ dir.child("one").touch().unwrap();
+ dir.child("two").touch().unwrap();
+ cmd()
+ .arg("--almost-all")
+ .arg(dir.path())
+ .assert()
+ .stdout(predicate::str::is_match(".* one\n.* two\n$").unwrap());
}
#[test]
@@ -48,7 +81,21 @@ fn test_list_all_populated_directory() {
.arg("--all")
.arg(dir.path())
.assert()
- .stdout(predicate::eq(".\n..\none\ntwo\n"));
+ .stdout(predicate::str::is_match(".* \\.\n.* \\.\\.\n.* one\n.* two\n$").unwrap());
+}
+
+#[test]
+#[cfg(unix)]
+fn test_list_inode_populated_directory() {
+ let dir = tempdir();
+ dir.child("one").touch().unwrap();
+ dir.child("two").touch().unwrap();
+ cmd()
+ .arg("--blocks")
+ .arg("inode,name")
+ .arg(dir.path())
+ .assert()
+ .stdout(predicate::str::is_match("\\d+ one\n\\d+ two\n$").unwrap());
}
fn cmd() -> Command {