mirror of
https://github.com/nushell/nushell.git
synced 2025-02-23 05:51:28 +01:00
Revert range expansion for to nuon
(#8210)
# Description The code to generate the nuon format supports writing range literals, which obviates the need to expand the range as added in #8047 # User-Facing Changes `to nuon` will still output ranges as literals # Tests + Formatting - Add test for `to nuon` range output - Add `from nuon` test for range
This commit is contained in:
parent
b36ac8f2f8
commit
836a56b347
@ -34,7 +34,6 @@ impl Command for ToNuon {
|
|||||||
call: &Call,
|
call: &Call,
|
||||||
input: PipelineData,
|
input: PipelineData,
|
||||||
) -> Result<PipelineData, ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let input = input.try_expand_range()?;
|
|
||||||
Ok(Value::String {
|
Ok(Value::String {
|
||||||
val: to_nuon(call, input)?,
|
val: to_nuon(call, input)?,
|
||||||
span: call.head,
|
span: call.head,
|
||||||
|
@ -177,6 +177,33 @@ fn to_nuon_records() {
|
|||||||
assert_eq!(actual.out, "true");
|
assert_eq!(actual.out, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn to_nuon_range() {
|
||||||
|
let actual = nu!(
|
||||||
|
cwd: "tests/fixtures/formats", pipeline(
|
||||||
|
r#"
|
||||||
|
1..42
|
||||||
|
| to nuon
|
||||||
|
"#
|
||||||
|
));
|
||||||
|
|
||||||
|
assert_eq!(actual.out, "1..42");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn from_nuon_range() {
|
||||||
|
let actual = nu!(
|
||||||
|
cwd: "tests/fixtures/formats", pipeline(
|
||||||
|
r#"
|
||||||
|
"1..42"
|
||||||
|
| from nuon
|
||||||
|
| describe
|
||||||
|
"#
|
||||||
|
));
|
||||||
|
|
||||||
|
assert_eq!(actual.out, "range");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn binary_to() {
|
fn binary_to() {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
|
Loading…
Reference in New Issue
Block a user