Skip to content

Commit

Permalink
tests: add one more joinp --maintain-order test; correct misnamed test
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
jqnatividad committed Dec 8, 2024
1 parent aadfd28 commit 89fb95c
Showing 1 changed file with 48 additions and 2 deletions.
50 changes: 48 additions & 2 deletions tests/test_joinp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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<Vec<String>> = 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);
}

0 comments on commit 89fb95c

Please sign in to comment.