forked from extern/nushell
To nuon escapes (#6660)
* Add tests for "to nuon" escaping handling * Fix "to nuon" not escaping double quotations * Fix "to nuon" double backslash Fix value_to_string_without_quotes leaving escaped backslash in non-quoted strings
This commit is contained in:
@ -103,6 +103,51 @@ fn to_nuon_escaping2() {
|
||||
assert_eq!(actual.out, "hello\\world");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_nuon_escaping3() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
["hello\\world"]
|
||||
| to nuon
|
||||
| from nuon
|
||||
| $in == [hello\world]
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_nuon_escaping4() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
["hello\"world"]
|
||||
| to nuon
|
||||
| from nuon
|
||||
| $in == ["hello\"world"]
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_nuon_escaping5() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
{s: "hello\"world"}
|
||||
| to nuon
|
||||
| from nuon
|
||||
| $in == {s: "hello\"world"}
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn to_nuon_negative_int() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user