Skip to content

Commit

Permalink
tests: add apply dynfmt test for issue 1458
Browse files Browse the repository at this point in the history
see #1458
  • Loading branch information
jqnatividad committed Dec 7, 2023
1 parent 7b5d82a commit e3fc097
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,38 @@ fn apply_dynfmt_keepcase() {
assert_eq!(got, expected);
}

#[test]
fn apply_dynfmt_issue1458() {
let wrk = Workdir::new("apply_dynfmt_issue1458");
wrk.create(
"data.csv",
vec![
svec!["FirstName", "MI", "LastName",],
svec!["Adam", "B", "Case"],
svec!["Derek", "E", "Foster"],
svec!["Gordon", "H", "Irvin"],
svec!["Jack", "K", "Lynch"],
],
);
let mut cmd = wrk.command("apply");
cmd.arg("dynfmt")
.arg("--formatstr")
.arg("Sir/Madam {FirstName} {MI}. {LastName}")
.arg("-c")
.arg("FullName")
.arg("data.csv");

let got: Vec<Vec<String>> = wrk.read_stdout(&mut cmd);
let expected = vec![
svec!["FirstName", "MI", "LastName", "FullName"],
svec!["Adam", "B", "Case", "Sir/Madam Adam B. Case"],
svec!["Derek", "E", "Foster", "Sir/Madam Derek E. Foster"],
svec!["Gordon", "H", "Irvin", "Sir/Madam Gordon H. Irvin"],
svec!["Jack", "K", "Lynch", "Sir/Madam Jack K. Lynch"],
];
assert_eq!(got, expected);
}

#[test]
fn apply_calcconv() {
let wrk = Workdir::new("apply");
Expand Down

0 comments on commit e3fc097

Please sign in to comment.