From 75edd9e89e5c5c06ea532576360d1bcad06dd4ed Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Sun, 17 Nov 2024 17:38:47 -0500 Subject: [PATCH] tests: add test for #2294 --- tests/test_tojsonl.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/test_tojsonl.rs b/tests/test_tojsonl.rs index 6e9282f93..de3e79807 100644 --- a/tests/test_tojsonl.rs +++ b/tests/test_tojsonl.rs @@ -27,6 +27,31 @@ fn tojsonl_simple() { assert_eq!(got, expected); } +#[test] +#[serial] +fn tojsonl_2294() { + let wrk = Workdir::new("tojsonl_simple"); + wrk.create( + "file.csv", + vec![ + svec!["col1", "col2", "col3"], + svec!["a", "b", "c"], + svec!["d", "e", "f"], + ], + ); + + wrk.create_subdir("qsv test").unwrap(); + std::fs::rename(wrk.path("file.csv"), wrk.path("qsv test").join("file.csv")).unwrap(); + + let mut cmd = wrk.command("tojsonl"); + cmd.arg("qsv test/file.csv"); + + let got: String = wrk.stdout(&mut cmd); + let expected = r#"{"col1":"a","col2":"b","col3":"c"} +{"col1":"d","col2":"e","col3":"f"}"#; + assert_eq!(got, expected); +} + #[test] #[serial] fn tojsonl_boolean() {