Skip to content

Commit

Permalink
chore: use variable shadowing in tests consistently
Browse files Browse the repository at this point in the history
no need to use var2, var3, etc.
  • Loading branch information
jqnatividad committed Nov 24, 2024
1 parent 1be0c0e commit b4af56e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
12 changes: 6 additions & 6 deletions tests/test_joinp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,19 @@ fn setup(name: &str) -> Workdir {
drop(cmd);

let out_file2 = wrk.path("places.csv.sz").to_string_lossy().to_string();
let mut cmd_2 = wrk.command("snappy");
cmd_2
let mut cmd = wrk.command("snappy");
cmd
.arg("compress")
.arg("places.csv")
.args(["--output", &out_file2]);
wrk.assert_success(&mut cmd_2);
wrk.assert_success(&mut cmd);

let out_file3 = wrk.path("places.ssv.sz").to_string_lossy().to_string();
let mut cmd3 = wrk.command("snappy");
cmd3.arg("compress")
let mut cmd = wrk.command("snappy");
cmd.arg("compress")
.arg("places.ssv")
.args(["--output", &out_file3]);
wrk.assert_success(&mut cmd3);
wrk.assert_success(&mut cmd);

wrk
}
Expand Down
18 changes: 9 additions & 9 deletions tests/test_snappy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ fn snappy_roundtrip() {

wrk.assert_success(&mut cmd);

let mut cmd2 = wrk.command("snappy"); // DevSkim: ignore DS126858
cmd2.arg("decompress").arg(out_file); // DevSkim: ignore DS126858
let mut cmd = wrk.command("snappy"); // DevSkim: ignore DS126858
cmd.arg("decompress").arg(out_file); // DevSkim: ignore DS126858

let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd2); // DevSkim: ignore DS126858
let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd); // DevSkim: ignore DS126858
assert_eq!(got, thedata);

wrk.assert_success(&mut cmd2); // DevSkim: ignore DS126858
wrk.assert_success(&mut cmd);
}

#[test]
Expand Down Expand Up @@ -188,14 +188,14 @@ fn snappy_automatic_compression() {

let got_path = wrk.path("out.csv.sz");

let mut cmd2 = wrk.command("count"); // DevSkim: ignore DS126858
cmd2.arg(got_path); // DevSkim: ignore DS126858
let mut cmd = wrk.command("count");
cmd.arg(got_path);

wrk.assert_success(&mut cmd2); // DevSkim: ignore DS126858
wrk.assert_success(&mut cmd);

let got: String = wrk.stdout(&mut cmd2); // DevSkim: ignore DS126858
let got: String = wrk.stdout(&mut cmd);
let expected = "50";
assert_eq!(got, expected);

wrk.assert_success(&mut cmd2); // DevSkim: ignore DS126858
wrk.assert_success(&mut cmd);
}
24 changes: 12 additions & 12 deletions tests/test_to.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ fn to_xlsx_roundtrip() {

wrk.assert_success(&mut cmd);

let mut cmd2 = wrk.command("excel");
cmd2.arg(xlsx_file);
let mut cmd = wrk.command("excel");
cmd.arg(xlsx_file);

let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd2);
let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd);
assert_eq!(got, thedata);

wrk.assert_success(&mut cmd2);
wrk.assert_success(&mut cmd);
}

#[test]
Expand Down Expand Up @@ -82,21 +82,21 @@ fn to_xlsx_dir() {

wrk.assert_success(&mut cmd);

let mut cmd2 = wrk.command("excel");
cmd2.arg(xlsx_file.clone()).args(&["--sheet", "cities"]);
let mut cmd = wrk.command("excel");
cmd.arg(xlsx_file.clone()).args(&["--sheet", "cities"]);

let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd2);
let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd);
assert_eq!(got, cities);

wrk.assert_success(&mut cmd2);
wrk.assert_success(&mut cmd);

let mut cmd2 = wrk.command("excel");
cmd2.arg(xlsx_file).args(&["--sheet", "places"]);
let mut cmd = wrk.command("excel");
cmd.arg(xlsx_file).args(&["--sheet", "places"]);

let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd2);
let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd);
assert_eq!(got, places);

wrk.assert_success(&mut cmd2);
wrk.assert_success(&mut cmd);
}

#[test]
Expand Down

0 comments on commit b4af56e

Please sign in to comment.