mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
make echo
const (#14997)
# Description Make `echo` const. - It's a very simple command, there is no reason for it to not be const. - It's return type `any` is utilized in tests to type erase values, this might be useful for testing const evaluation too. - The upcoming custom command attribute feature can make use of it as a stopgap replacement for `const def` commands. # User-Facing Changes `echo` can be used in const contexts. # Tests + Formatting # After Submitting N/A
This commit is contained in:
@ -34,3 +34,9 @@ fn echo_range_handles_exclusive_down() {
|
||||
|
||||
assert_eq!(actual.out, "[3,2]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn echo_is_const() {
|
||||
let actual = nu!(r#"const val = echo 1..3; $val | to json --raw"#);
|
||||
assert_eq!(actual.out, "[1,2,3]");
|
||||
}
|
||||
|
Reference in New Issue
Block a user