From 58efe9ead0ce42fcbd7836053912df0505d62354 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Sat, 11 Jan 2025 22:42:42 -0500 Subject: [PATCH] test: rewrite `join_inner_zeros_casei` test not use the `join_test_with_zeros!` macro --- tests/test_join.rs | 76 ++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 43 deletions(-) diff --git a/tests/test_join.rs b/tests/test_join.rs index 438b9d921..43425a1ff 100644 --- a/tests/test_join.rs +++ b/tests/test_join.rs @@ -683,52 +683,42 @@ join_test_with_zeros!( } ); -join_test_with_zeros!( - join_inner_zeros_casei, - |wrk: Workdir, mut cmd: process::Command, headers: bool| { - let mut cities1 = vec![ - svec!["01NYC", "data1"], - svec!["02LA", "data2"], - svec!["1nyc", "data3"], - ]; - let mut cities2 = vec![ - svec!["1NYC", "info1"], - svec!["2la", "info2"], - svec!["01nyc", "info3"], - ]; - if headers { - cities1.insert(0, svec!["id", "value"]); - cities2.insert(0, svec!["id", "info"]); - } +#[test] +fn join_inner_zeros_casei() { + let wrk = Workdir::new("join_inner_zeros_casei"); + + let cities1 = vec![ + svec!["id", "value"], + svec!["01NYC", "data1"], + svec!["02LA", "data2"], + svec!["1nyc", "data3"], + ]; + let cities2 = vec![ + svec!["id", "info"], + svec!["1NYC", "info1"], + svec!["2la", "info2"], + svec!["01nyc", "info3"], + ]; - let wrk = Workdir::new("join_inner_zeros_casei"); - wrk.create("cities1.csv", cities1); - wrk.create("cities2.csv", cities2); + wrk.create("cities1.csv", cities1); + wrk.create("cities2.csv", cities2); - let mut cmd = wrk.command("join"); - if headers { - cmd.args(&["id", "cities1.csv", "id", "cities2.csv"]); - } else { - cmd.args(&["1", "cities1.csv", "1", "cities2.csv"]) - .arg("--no-headers"); - } - cmd.arg("--ignore-leading-zeros").arg("--ignore-case"); + let mut cmd = wrk.command("join"); + cmd.args(&["id", "cities1.csv", "id", "cities2.csv"]) + .arg("--ignore-leading-zeros") + .arg("--ignore-case"); - let got: Vec> = wrk.read_stdout(&mut cmd); - let expected = make_rows_with_zeros( - headers, - false, - vec![ - svec!["01NYC", "data1", "1NYC", "info1"], - svec!["01NYC", "data1", "01nyc", "info3"], - svec!["02LA", "data2", "2la", "info2"], - svec!["1nyc", "data3", "1NYC", "info1"], - svec!["1nyc", "data3", "01nyc", "info3"], - ], - ); - assert_eq!(got, expected); - } -); + let got: Vec> = wrk.read_stdout(&mut cmd); + let expected = vec![ + svec!["id", "value", "id", "info"], + svec!["01NYC", "data1", "1NYC", "info1"], + svec!["01NYC", "data1", "01nyc", "info3"], + svec!["02LA", "data2", "2la", "info2"], + svec!["1nyc", "data3", "1NYC", "info1"], + svec!["1nyc", "data3", "01nyc", "info3"], + ]; + assert_eq!(got, expected); +} join_test_with_zeros!( join_outer_left_zeros,