Skip to content

Commit

Permalink
Merge pull request #112 from jhscheer/refactor_tests_noconfig
Browse files Browse the repository at this point in the history
refactor tests: move --no-config to mod::run_cmd
  • Loading branch information
solidiquis authored Apr 2, 2023
2 parents 61cc59b + 31b1ff8 commit d462932
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion tests/dirs_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod utils;
#[test]
fn dirs_only() {
assert_eq!(
utils::run_cmd(&["--dirs-only", "--sort", "name", "--no-config", "tests/data"]),
utils::run_cmd(&["--dirs-only", "--sort", "name", "tests/data"]),
indoc!(
"
data (1.21 KiB)
Expand Down
3 changes: 1 addition & 2 deletions tests/file_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod utils;
#[test]
fn file_count() {
assert_eq!(
utils::run_cmd(&["--count", "--sort", "name", "--no-config", "tests/data"]),
utils::run_cmd(&["--count", "--sort", "name", "tests/data"]),
indoc!(
"
data (1.21 KiB)
Expand All @@ -32,7 +32,6 @@ fn file_count_report() {
"--report",
"--sort",
"name",
"--no-config",
"tests/data"
]),
indoc!(
Expand Down
4 changes: 0 additions & 4 deletions tests/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ fn glob() {
"name",
"--glob",
"*.txt",
"--no-config",
"tests/data"
]),
indoc!(
Expand All @@ -36,7 +35,6 @@ fn glob_negative() {
"name",
"--glob",
"!*.txt",
"--no-config",
"tests/data"
]),
indoc!(
Expand All @@ -59,7 +57,6 @@ fn glob_case_insensitive() {
"--glob",
"*.TXT",
"--glob-case-insensitive",
"--no-config",
"tests/data"
]),
indoc!(
Expand All @@ -85,7 +82,6 @@ fn iglob() {
"name",
"--iglob",
"*.TXT",
"--no-config",
"tests/data"
]),
indoc!(
Expand Down
1 change: 0 additions & 1 deletion tests/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ fn level() {
"name",
"--level",
"1",
"--no-config",
"tests/data"
]),
indoc!(
Expand Down
1 change: 0 additions & 1 deletion tests/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ fn prune() {
"name",
"--glob",
"*.txt",
"--no-config",
"--prune",
"tests/data"
]),
Expand Down
4 changes: 1 addition & 3 deletions tests/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod utils;
#[test]
fn report() {
assert_eq!(
utils::run_cmd(&["--report", "--sort", "name", "--no-config", "tests/data"]),
utils::run_cmd(&["--report", "--sort", "name", "tests/data"]),
indoc!(
"
d 1241 B data
Expand All @@ -30,7 +30,6 @@ fn report_human() {
"--human",
"--sort",
"name",
"--no-config",
"tests/data"
]),
indoc!(
Expand Down Expand Up @@ -58,7 +57,6 @@ fn report_with_level() {
"1",
"--sort",
"name",
"--no-config",
"tests/data"
]),
indoc!(
Expand Down
4 changes: 1 addition & 3 deletions tests/size_left.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod utils;
#[test]
fn size_left_bin() {
assert_eq!(
utils::run_cmd(&["--sort", "name", "--no-config", "--size-left", "tests/data"]),
utils::run_cmd(&["--sort", "name", "--size-left", "tests/data"]),
"1.21 KiB data
308 B ├─ dream_cycle
308 B │ └─ polaris.txt
Expand All @@ -23,7 +23,6 @@ fn size_left_si() {
utils::run_cmd(&[
"--sort",
"name",
"--no-config",
"-p",
"si",
"--size-left",
Expand All @@ -48,7 +47,6 @@ fn size_left_altered_precision() {
utils::run_cmd(&[
"--sort",
"name",
"--no-config",
"-n",
"3",
"--size-left",
Expand Down
6 changes: 2 additions & 4 deletions tests/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod utils;
#[test]
fn sort_name() {
assert_eq!(
utils::run_cmd(&["--sort", "name", "--no-config", "tests/data"]),
utils::run_cmd(&["--sort", "name", "tests/data"]),
indoc!(
"
data (1.21 KiB)
Expand All @@ -30,7 +30,6 @@ fn sort_name_dir_first() {
"--sort",
"name",
"--dirs-first",
"--no-config",
"tests/data"
]),
indoc!(
Expand All @@ -53,7 +52,7 @@ fn sort_name_dir_first() {
#[test]
fn sort_size() {
assert_eq!(
utils::run_cmd(&["--sort", "size", "--no-config", "tests/data"]),
utils::run_cmd(&["--sort", "size", "tests/data"]),
indoc!(
"
data (1.21 KiB)
Expand All @@ -78,7 +77,6 @@ fn sort_size_dir_first() {
"--sort",
"size",
"--dirs-first",
"--no-config",
"tests/data"
]),
indoc!(
Expand Down
1 change: 0 additions & 1 deletion tests/suppress_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ fn suppress_size() {
"--suppress-size",
"--sort",
"name",
"--no-config",
"tests/data"
]),
indoc!(
Expand Down
1 change: 0 additions & 1 deletion tests/symlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ mod test {
"--sort",
"name",
"--follow-links",
"--no-config",
&link_canonical
]),
indoc!(
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strip_ansi_escapes::strip as strip_ansi_escapes;

pub fn run_cmd(args: &[&str]) -> String {
let mut cmd = Command::new("cargo");
cmd.arg("run").arg("--").arg("--threads").arg("1");
cmd.args(["run", "--", "--threads", "1", "--no-config"]);

for arg in args {
cmd.arg(arg);
Expand Down

0 comments on commit d462932

Please sign in to comment.