From b4af56e2e62e98eeeaae7baa5b06172b3afe3be0 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Sun, 24 Nov 2024 10:16:40 -0500 Subject: [PATCH] chore: use variable shadowing in tests consistently no need to use var2, var3, etc. --- tests/test_joinp.rs | 12 ++++++------ tests/test_snappy.rs | 18 +++++++++--------- tests/test_to.rs | 24 ++++++++++++------------ 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/tests/test_joinp.rs b/tests/test_joinp.rs index 448d6828f..6578f9afa 100644 --- a/tests/test_joinp.rs +++ b/tests/test_joinp.rs @@ -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 } diff --git a/tests/test_snappy.rs b/tests/test_snappy.rs index a30f25718..4171bb4b5 100644 --- a/tests/test_snappy.rs +++ b/tests/test_snappy.rs @@ -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> = wrk.read_stdout(&mut cmd2); // DevSkim: ignore DS126858 + let got: Vec> = 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] @@ -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); } diff --git a/tests/test_to.rs b/tests/test_to.rs index 51a03441c..c3fbabd81 100644 --- a/tests/test_to.rs +++ b/tests/test_to.rs @@ -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> = wrk.read_stdout(&mut cmd2); + let got: Vec> = wrk.read_stdout(&mut cmd); assert_eq!(got, thedata); - wrk.assert_success(&mut cmd2); + wrk.assert_success(&mut cmd); } #[test] @@ -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> = wrk.read_stdout(&mut cmd2); + let got: Vec> = 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> = wrk.read_stdout(&mut cmd2); + let got: Vec> = wrk.read_stdout(&mut cmd); assert_eq!(got, places); - wrk.assert_success(&mut cmd2); + wrk.assert_success(&mut cmd); } #[test]