Allow save to accept a list of strings (#4743)

This commit is contained in:
Genna Wingert
2022-03-05 22:56:04 +01:00
committed by GitHub
parent 1527b34d9c
commit 4aa9a18c63
2 changed files with 46 additions and 0 deletions

View File

@ -49,6 +49,24 @@ fn writes_out_csv() {
})
}
#[test]
fn writes_out_list() {
Playground::setup("save_test_3", |dirs, sandbox| {
sandbox.with_files(vec![]);
let expected_file = dirs.test().join("list_sample.txt");
nu!(
cwd: dirs.root(),
r#"echo [a b c d] | save save_test_3/list_sample.txt"#,
);
let actual = file_contents(expected_file);
println!("{actual}");
assert_eq!(actual, "a\nb\nc\nd\n")
})
}
#[test]
fn save_append_will_create_file_if_not_exists() {
Playground::setup("save_test_3", |dirs, sandbox| {