mirror of
https://github.com/nushell/nushell.git
synced 2025-08-17 18:41:53 +02:00
preserve space by letting to nuon
only add quotes when necessary (#6379)
* preserve space by letting `to nuon` only add quotes when necessary * fix CI, add quotes with colon * fmt * add more chars to blacklist
This commit is contained in:
@ -249,3 +249,21 @@ fn to_nuon_converts_columns_with_spaces() {
|
||||
));
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_nuon_does_not_quote_unnecessarily() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
let test = [["a", "b", "c d"]; [1 2 3] [4 5 6]]; $test | to nuon
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual.out, "[[a, b, \"c d\"]; [1, 2, 3], [4, 5, 6]]");
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
let a = {"ro name": "sam" rank: 10}; $a | to nuon
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual.out, "{\"ro name\": sam, rank: 10}");
|
||||
}
|
||||
|
Reference in New Issue
Block a user