diff --git a/crates/nu-command/tests/format_conversions/nuon.rs b/crates/nu-command/tests/format_conversions/nuon.rs index fb02c73a8..eaba7614f 100644 --- a/crates/nu-command/tests/format_conversions/nuon.rs +++ b/crates/nu-command/tests/format_conversions/nuon.rs @@ -126,3 +126,39 @@ fn binary_roundtrip() { assert_eq!(actual.out, "0x[1FFF]"); } + +#[test] +fn read_binary_data() { + let actual = nu!( + cwd: "tests/fixtures/formats", pipeline( + r#" + open sample.nuon | get 5.3 + "# + )); + + assert_eq!(actual.out, "31") +} + +#[test] +fn read_record() { + let actual = nu!( + cwd: "tests/fixtures/formats", pipeline( + r#" + open sample.nuon | get 4.name + "# + )); + + assert_eq!(actual.out, "Bobby") +} + +#[test] +fn read_bool() { + let actual = nu!( + cwd: "tests/fixtures/formats", pipeline( + r#" + open sample.nuon | get 3 | $in == $true + "# + )); + + assert_eq!(actual.out, "true") +} diff --git a/crates/nu-engine/src/column.rs b/crates/nu-engine/src/column.rs index 834ad2c86..28e4a7452 100644 --- a/crates/nu-engine/src/column.rs +++ b/crates/nu-engine/src/column.rs @@ -11,6 +11,8 @@ pub fn get_columns(input: &[Value]) -> Vec { columns.push(col.to_string()); } } + } else { + return vec![]; } } diff --git a/tests/fixtures/formats/sample.nuon b/tests/fixtures/formats/sample.nuon new file mode 100644 index 000000000..68b93ddfe --- /dev/null +++ b/tests/fixtures/formats/sample.nuon @@ -0,0 +1,20 @@ +# Some sample nuon values +[ + # The nuon compact table format + [[a, nuon, table]; [1, 2, 3], [4, 5, 6]], + + # A filesize + 100kib, + + # A duration + 100sec + + # A boolean + true, + + # A record + {name: "Bobby", age: 99} + + # Binary data + 0x[11, ff, ee, 1f] +] \ No newline at end of file