forked from extern/nushell
make save
stream on list stream data (#7675)
# Description Closes: #7590 # User-Facing Changes So the following command ``` 1..100 | each { |i| sleep 400ms; $i} | save --raw -f output.txt ``` Will stream data to `output.txt` But I'm note sure how to make a proper test for it, so I leave with no new test cases.. Also rename from `string_binary_list_value_to_bytes ` to `value_to_bytes` to accepts more Value type. # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
@ -264,3 +264,20 @@ fn save_override_works_stderr() {
|
||||
assert_eq!(actual, "New Err\n");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn save_list_stream() {
|
||||
Playground::setup("save_test_13", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![]);
|
||||
|
||||
let expected_file = dirs.test().join("list_sample.txt");
|
||||
|
||||
nu!(
|
||||
cwd: dirs.root(),
|
||||
r#"[a b c d] | each {|i| $i} | save -r save_test_13/list_sample.txt"#,
|
||||
);
|
||||
|
||||
let actual = file_contents(expected_file);
|
||||
assert_eq!(actual, "a\nb\nc\nd\n")
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user