diff --git a/tests/test_joinp.rs b/tests/test_joinp.rs index 8cb4e82c0..161ac6f1d 100644 --- a/tests/test_joinp.rs +++ b/tests/test_joinp.rs @@ -1378,8 +1378,8 @@ fn joinp_ignore_case_maintain_order_left() { } #[test] -fn joinp_ignore_case_maintain_order_right_left() { - let wrk = Workdir::new("joinp_mo_rl"); +fn joinp_ignore_case_maintain_order_left_right() { + let wrk = Workdir::new("joinp_mo_lr"); // Create test data with mixed case cities wrk.create( @@ -1422,3 +1422,49 @@ fn joinp_ignore_case_maintain_order_right_left() { ]; assert_eq!(got, expected); } + +#[test] +fn joinp_ignore_case_maintain_order_right_left() { + let wrk = Workdir::new("joinp_mo_rl"); + + // Create test data with mixed case cities + wrk.create( + "cities_mixed.csv", + vec![ + svec!["city", "state"], + svec!["BOSTON", "MA"], + svec!["new york", "NY"], + svec!["San Francisco", "CA"], + svec!["BUFFALO", "NY"], + ], + ); + + wrk.create( + "places_mixed.csv", + vec![ + svec!["city", "place"], + svec!["Boston", "Logan Airport"], + svec!["boston", "Boston Garden"], + svec!["BUFFALO", "Ralph Wilson Stadium"], + svec!["orlando", "Disney World"], + svec!["new York", "Madison Square Garden"], + svec!["san francisco", "Fisherman's Wharf"], + ], + ); + + let mut cmd = wrk.command("joinp"); + cmd.args(&["city", "cities_mixed.csv", "city", "places_mixed.csv"]) + .arg("--ignore-case") + .args(["--maintain-order", "right_left"]); + + let got: Vec> = wrk.read_stdout(&mut cmd); + let expected = vec![ + svec!["city", "state", "city_right", "place"], + svec!["BOSTON", "MA", "Boston", "Logan Airport"], + svec!["BOSTON", "MA", "boston", "Boston Garden"], + svec!["BUFFALO", "NY", "BUFFALO", "Ralph Wilson Stadium"], + svec!["new york", "NY", "new York", "Madison Square Garden"], + svec!["San Francisco", "CA", "san francisco", "Fisherman's Wharf"], + ]; + assert_eq!(got, expected); +}