summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKai Moschcau <mail@kmoschcau.de>2020-09-24 20:09:26 +0200
committerAbin Simon <abinsimon10@gmail.com>2020-10-02 10:08:37 +0530
commit55a96a114d181cda9d3dfecf553908ea8e9b102d (patch)
treec392378e8c3f451107cdc87c7334ed531a5cb967 /tests
parent5fea5cda092c377b4f4852935bf7b38d5e7fee14 (diff)
Add ability to configure default options with file
# Conflicts: # Cargo.lock # Cargo.toml # README.md # src/app.rs # src/core.rs # src/display.rs # src/flags.rs # src/meta/mod.rs # src/sort.rs # tests/integration.rs
Diffstat (limited to 'tests')
-rw-r--r--tests/integration.rs65
1 files changed, 60 insertions, 5 deletions
diff --git a/tests/integration.rs b/tests/integration.rs
index 4fb81e8..59083c0 100644
--- a/tests/integration.rs
+++ b/tests/integration.rs
@@ -17,6 +17,7 @@ fn test_runs_okay() {
#[test]
fn test_list_empty_directory() {
cmd()
+ .arg("--no-config")
.arg(tempdir().path())
.assert()
.stdout(predicate::eq(""));
@@ -27,12 +28,14 @@ fn test_list_almost_all_empty_directory() {
let matched = "";
cmd()
.arg("--almost-all")
+ .arg("--no-config")
.arg(tempdir().path())
.assert()
.stdout(predicate::eq(matched));
cmd()
.arg("-A")
+ .arg("--no-config")
.arg(tempdir().path())
.assert()
.stdout(predicate::eq(matched));
@@ -43,12 +46,14 @@ fn test_list_all_empty_directory() {
let matched = "\\.\n\\.\\.\n$";
cmd()
.arg("--all")
+ .arg("--no-config")
.arg(tempdir().path())
.assert()
.stdout(predicate::str::is_match(matched).unwrap());
cmd()
.arg("-a")
+ .arg("--no-config")
.arg(tempdir().path())
.assert()
.stdout(predicate::str::is_match(matched).unwrap());
@@ -60,6 +65,7 @@ fn test_list_populated_directory() {
dir.child("one").touch().unwrap();
dir.child("two").touch().unwrap();
cmd()
+ .arg("--no-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match("one\ntwo\n$").unwrap());
@@ -72,6 +78,7 @@ fn test_list_almost_all_populated_directory() {
dir.child("two").touch().unwrap();
cmd()
.arg("--almost-all")
+ .arg("--no-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match("one\ntwo\n$").unwrap());
@@ -84,6 +91,7 @@ fn test_list_all_populated_directory() {
dir.child("two").touch().unwrap();
cmd()
.arg("--all")
+ .arg("--no-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match("\\.\n\\.\\.\none\ntwo\n$").unwrap());
@@ -102,18 +110,40 @@ fn test_list_inode_populated_directory() {
cmd()
.arg("--inode")
+ .arg("--no-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match(matched).unwrap());
cmd()
.arg("-i")
+ .arg("--no-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match(matched).unwrap());
}
#[test]
-fn test_list_block_inode_populated_directory() {
+fn test_list_block_inode_populated_directory_without_long() {
+ let dir = tempdir();
+ dir.child("one").touch().unwrap();
+ dir.child("two").touch().unwrap();
+
+ #[cfg(unix)]
+ let matched = "one\ntwo\n$";
+ #[cfg(windows)]
+ let matched = "one\ntwo\n$";
+
+ cmd()
+ .arg("--blocks")
+ .arg("inode,name")
+ .arg("--no-config")
+ .arg(dir.path())
+ .assert()
+ .stdout(predicate::str::is_match(matched).unwrap());
+}
+
+#[test]
+fn test_list_block_inode_populated_directory_with_long() {
let dir = tempdir();
dir.child("one").touch().unwrap();
dir.child("two").touch().unwrap();
@@ -124,8 +154,10 @@ fn test_list_block_inode_populated_directory() {
let matched = "- one\n\\- two\n$";
cmd()
+ .arg("--long")
.arg("--blocks")
.arg("inode,name")
+ .arg("--no-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match(matched).unwrap());
@@ -134,7 +166,13 @@ fn test_list_block_inode_populated_directory() {
#[test]
fn test_list_inode_with_long_ok() {
let dir = tempdir();
- cmd().arg("-i").arg("-l").arg(dir.path()).assert().success();
+ cmd()
+ .arg("-i")
+ .arg("-l")
+ .arg("--no-config")
+ .arg(dir.path())
+ .assert()
+ .success();
}
#[cfg(unix)]
@@ -147,11 +185,13 @@ fn test_list_broken_link_ok() {
cmd()
.arg(&broken_link)
+ .arg("--no-config")
.assert()
.stderr(predicate::str::contains(matched).not());
cmd()
.arg("-l")
+ .arg("--no-config")
.arg(broken_link)
.assert()
.stderr(predicate::str::contains(matched).not());
@@ -167,11 +207,13 @@ fn test_nosymlink_on_non_long() {
cmd()
.arg("-l")
+ .arg("--no-config")
.arg(&link)
.assert()
.stdout(predicate::str::contains(link_icon));
cmd()
+ .arg("--no-config")
.arg(&link)
.assert()
.stdout(predicate::str::contains(link_icon).not());
@@ -190,6 +232,7 @@ fn test_dereference_link_right_type_and_no_link() {
cmd()
.arg("-l")
.arg("--dereference")
+ .arg("--no-config")
.arg(&link)
.assert()
.stdout(predicate::str::starts_with(file_type))
@@ -198,6 +241,7 @@ fn test_dereference_link_right_type_and_no_link() {
cmd()
.arg("-l")
.arg("-L")
+ .arg("--no-config")
.arg(link)
.assert()
.stdout(predicate::str::starts_with(file_type))
@@ -213,6 +257,7 @@ fn test_show_folder_content_of_symlink() {
fs::symlink("target", &link).unwrap();
cmd()
+ .arg("--no-config")
.arg(link)
.assert()
.stdout(predicate::str::starts_with("link").not())
@@ -229,6 +274,7 @@ fn test_no_show_folder_content_of_symlink_for_long() {
cmd()
.arg("-l")
+ .arg("--no-config")
.arg(link)
.assert()
.stdout(predicate::str::starts_with("lrw"))
@@ -236,6 +282,7 @@ fn test_no_show_folder_content_of_symlink_for_long() {
cmd()
.arg("-l")
+ .arg("--no-config")
.arg(dir.path().join("link/"))
.assert()
.stdout(predicate::str::starts_with(".rw"))
@@ -252,6 +299,7 @@ fn test_show_folder_of_symlink_for_long_multi() {
cmd()
.arg("-l")
+ .arg("--no-config")
.arg(dir.path().join("link/"))
.arg(dir.path().join("link"))
.assert()
@@ -272,9 +320,14 @@ fn test_version_sort() {
dir.child("11").touch().unwrap();
dir.child("2").touch().unwrap();
dir.child("22").touch().unwrap();
- cmd().arg("-v").arg(dir.path()).assert().stdout(
- predicate::str::is_match("0.2\n0.3.7\n0.11\n0.11.5\n1\n2\n11\n11a\n22\n$").unwrap(),
- );
+ cmd()
+ .arg("-v")
+ .arg("--no-config")
+ .arg(dir.path())
+ .assert()
+ .stdout(
+ predicate::str::is_match("0.2\n0.3.7\n0.11\n0.11.5\n1\n2\n11\n11a\n22\n$").unwrap(),
+ );
}
#[test]
@@ -285,6 +338,7 @@ fn test_version_sort_overwrite_by_timesort() {
cmd()
.arg("-v")
.arg("-t")
+ .arg("--no-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match("11\n2\n$").unwrap());
@@ -302,6 +356,7 @@ fn test_version_sort_overwrite_by_sizesort() {
cmd()
.arg("-v")
.arg("-S")
+ .arg("--no-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match("11\n2\n$").unwrap());