From aaba8b05ba399ecfa8a892edb7ef8370fec35879 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Wed, 25 Dec 2024 07:28:56 -0500 Subject: [PATCH] tests: `joinp` add tests for `--right-anti` and `--right-semi` joins --- tests/test_joinp.rs | 75 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/tests/test_joinp.rs b/tests/test_joinp.rs index e00b774fe..86868ad0a 100644 --- a/tests/test_joinp.rs +++ b/tests/test_joinp.rs @@ -1738,3 +1738,78 @@ fn test_joinp_cache_schema() { .arg("2"); wrk.assert_err(&mut cmd); } + +joinp_test!( + joinp_right_semi, + |wrk: Workdir, mut cmd: process::Command| { + cmd.arg("--right-semi"); + let got: Vec> = wrk.read_stdout(&mut cmd); + let expected = vec![ + svec!["city", "place"], + svec!["Boston", "Logan Airport"], + svec!["Boston", "Boston Garden"], + svec!["Buffalo", "Ralph Wilson Stadium"], + ]; + assert_eq!(got, expected); + } +); + +joinp_test_tab!( + joinp_right_semi_tab, + |wrk: Workdir, mut cmd: process::Command| { + cmd.arg("--right-semi"); + let got: Vec> = wrk.read_stdout(&mut cmd); + let expected = vec![ + svec!["city", "place"], + svec!["Boston", "Logan Airport"], + svec!["Boston", "Boston Garden"], + svec!["Buffalo", "Ralph Wilson Stadium"], + ]; + assert_eq!(got, expected); + } +); + +joinp_test_comments!( + joinp_right_semi_comments, + |wrk: Workdir, mut cmd: process::Command| { + cmd.arg("--right-semi"); + let got: Vec> = wrk.read_stdout(&mut cmd); + let expected = vec![ + svec!["city", "place"], + svec!["Boston", "Logan Airport"], + svec!["Boston", "Boston Garden"], + svec!["Buffalo", "Ralph Wilson Stadium"], + ]; + assert_eq!(got, expected); + } +); + +joinp_test!( + joinp_right_anti, + |wrk: Workdir, mut cmd: process::Command| { + cmd.arg("--right-anti"); + let got: Vec> = wrk.read_stdout(&mut cmd); + let expected = vec![svec!["city", "place"], svec!["Orlando", "Disney World"]]; + assert_eq!(got, expected); + } +); + +joinp_test_tab!( + joinp_right_anti_tab, + |wrk: Workdir, mut cmd: process::Command| { + cmd.arg("--right-anti"); + let got: Vec> = wrk.read_stdout(&mut cmd); + let expected = vec![svec!["city", "place"], svec!["Orlando", "Disney World"]]; + assert_eq!(got, expected); + } +); + +joinp_test_comments!( + joinp_right_anti_comments, + |wrk: Workdir, mut cmd: process::Command| { + cmd.arg("--right-anti"); + let got: Vec> = wrk.read_stdout(&mut cmd); + let expected = vec![svec!["city", "place"], svec!["Orlando", "Disney World"]]; + assert_eq!(got, expected); + } +);