don't use table compaction in to nuon if not a table (#4671)

* don't use table compaction in to nuon if not a table

* Make a proper nuon conversion test

* more nuon tests
This commit is contained in:
JT
2022-02-28 07:10:02 -05:00
committed by GitHub
parent ef70c8dbe4
commit 10364c4f22
3 changed files with 106 additions and 1 deletions

View File

@ -65,7 +65,7 @@ fn value_to_string(v: &Value, span: Span) -> Result<String, ShellError> {
Value::Int { val, .. } => Ok(format!("{}", *val)),
Value::List { vals, .. } => {
let headers = get_columns(vals);
if vals.iter().all(|x| x.columns() == headers) {
if !headers.is_empty() && vals.iter().all(|x| x.columns() == headers) {
// Table output
let headers_output = headers.join(", ");