forked from extern/nushell
add -e flag to print, to print the value to stderr (#5935)
* Refactor: make stdout write all and flush as generic function * support print to stderr
This commit is contained in:
23
crates/nu-command/tests/commands/print.rs
Normal file
23
crates/nu-command/tests/commands/print.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn print_to_stdout() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
"print 'hello world'"
|
||||
)
|
||||
);
|
||||
assert!(actual.out.contains("hello world"));
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn print_to_stderr() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
"print -e 'hello world'"
|
||||
)
|
||||
);
|
||||
assert!(actual.out.is_empty());
|
||||
assert!(actual.err.contains("hello world"));
|
||||
}
|
Reference in New Issue
Block a user