mirror of
https://github.com/nushell/nushell.git
synced 2025-06-01 15:46:04 +02:00
fix the tests by using to nuon --raw
to have single-line results
Commands used: ``` sd "to nuon\"" "to nuon --raw\"" **/*.rs git restore crates/nu-command/src/formats/to/nuon.rs ``` and some manuals tweaks as well.
This commit is contained in:
parent
5fe0fc9135
commit
9159377af8
@ -258,7 +258,7 @@ fn test_computable_style_closure_basic() {
|
||||
}
|
||||
};"#,
|
||||
"[bell book candle] | table | ignore",
|
||||
"ls | get name | to nuon",
|
||||
"ls | get name | to nuon --raw",
|
||||
];
|
||||
let actual_repl = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
assert_eq!(actual_repl.err, "");
|
||||
|
@ -111,7 +111,7 @@ fn test_time_closure() {
|
||||
use nu_test_support::{nu, nu_repl_code, playground::Playground};
|
||||
Playground::setup("test_time_closure", |dirs, _| {
|
||||
let inp = [
|
||||
r#"[2 3 4] | timeit { to nuon | save foo.txt }"#,
|
||||
r#"[2 3 4] | timeit { to nuon --raw | save foo.txt }"#,
|
||||
"open foo.txt",
|
||||
];
|
||||
let actual_repl = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
@ -125,7 +125,7 @@ fn test_time_closure_2() {
|
||||
use nu_test_support::{nu, nu_repl_code, playground::Playground};
|
||||
Playground::setup("test_time_closure", |dirs, _| {
|
||||
let inp = [
|
||||
r#"[2 3 4] | timeit {|e| {result: $e} | to nuon | save foo.txt }"#,
|
||||
r#"[2 3 4] | timeit {|e| {result: $e} | to nuon --raw | save foo.txt }"#,
|
||||
"open foo.txt",
|
||||
];
|
||||
let actual_repl = nu!(cwd: dirs.test(), nu_repl_code(&inp));
|
||||
|
@ -125,7 +125,7 @@ fn all_uses_enumerate_index() {
|
||||
fn unique_env_each_iteration() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"[1 2] | all { print ($env.PWD | str ends-with 'formats') | cd '/' | true } | to nuon"
|
||||
"[1 2] | all { print ($env.PWD | str ends-with 'formats') | cd '/' | true } | to nuon --raw"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "truetruetrue");
|
||||
|
@ -101,7 +101,7 @@ fn any_uses_enumerate_index() {
|
||||
fn unique_env_each_iteration() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"[1 2] | any { print ($env.PWD | str ends-with 'formats') | cd '/' | false } | to nuon"
|
||||
"[1 2] | any { print ($env.PWD | str ends-with 'formats') | cd '/' | false } | to nuon --raw"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "truetruefalse");
|
||||
|
@ -76,7 +76,7 @@ fn each_implicit_it_in_block() {
|
||||
fn each_uses_enumerate_index() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"[7 8 9 10] | enumerate | each {|el| $el.index } | to nuon"#
|
||||
r#"[7 8 9 10] | enumerate | each {|el| $el.index } | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "[0, 1, 2, 3]");
|
||||
@ -86,7 +86,7 @@ fn each_uses_enumerate_index() {
|
||||
fn each_while_uses_enumerate_index() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"[7 8 9 10] | enumerate | each while {|el| $el.index } | to nuon"#
|
||||
r#"[7 8 9 10] | enumerate | each while {|el| $el.index } | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "[0, 1, 2, 3]");
|
||||
|
@ -17,7 +17,7 @@ fn insert_the_column() {
|
||||
#[test]
|
||||
fn doesnt_convert_record_to_table() {
|
||||
let actual = nu!(
|
||||
cwd: ".", r#"{a:1} | insert b 2 | to nuon"#
|
||||
cwd: ".", r#"{a:1} | insert b 2 | to nuon --raw"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "{a: 1, b: 2}");
|
||||
@ -90,7 +90,7 @@ fn insert_past_end_list() {
|
||||
fn insert_uses_enumerate_index() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"[[a]; [7] [6]] | enumerate | insert b {|el| $el.index + 1 + $el.item.a } | flatten | to nuon"#
|
||||
r#"[[a]; [7] [6]] | enumerate | insert b {|el| $el.index + 1 + $el.item.a } | flatten | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "[[index, a, b]; [0, 7, 8], [1, 6, 8]]");
|
||||
|
@ -480,7 +480,7 @@ fn adding_lists() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
[1 3] ++ [5 6] | to nuon
|
||||
[1 3] ++ [5 6] | to nuon --raw
|
||||
"#
|
||||
));
|
||||
|
||||
@ -492,7 +492,7 @@ fn adding_list_and_value() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
[1 3] ++ 5 | to nuon
|
||||
[1 3] ++ 5 | to nuon --raw
|
||||
"#
|
||||
));
|
||||
|
||||
@ -504,7 +504,7 @@ fn adding_value_and_list() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
1 ++ [3 5] | to nuon
|
||||
1 ++ [3 5] | to nuon --raw
|
||||
"#
|
||||
));
|
||||
|
||||
@ -516,7 +516,7 @@ fn adding_tables() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
[[a b]; [1 2]] ++ [[c d]; [10 11]] | to nuon
|
||||
[[a b]; [1 2]] ++ [[c d]; [10 11]] | to nuon --raw
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual.out, "[{a: 1, b: 2}, {c: 10, d: 11}]");
|
||||
@ -538,7 +538,7 @@ fn append_binary_values() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
0x[01 02] ++ 0x[03 04] | to nuon
|
||||
0x[01 02] ++ 0x[03 04] | to nuon --raw
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual.out, "0x[01020304]");
|
||||
@ -562,12 +562,12 @@ fn int_multiple_string() {
|
||||
fn int_multiple_list() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"3 * [1 2] | to nuon"#
|
||||
r#"3 * [1 2] | to nuon --raw"#
|
||||
));
|
||||
assert_eq!(actual.out, "[1, 2, 1, 2, 1, 2]");
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"[1 2] * 3 | to nuon"#
|
||||
r#"[1 2] * 3 | to nuon --raw"#
|
||||
));
|
||||
assert_eq!(actual.out, "[1, 2, 1, 2, 1, 2]");
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ fn single_record_no_overwrite() {
|
||||
nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
{a: 1, b: 5} | merge {c: 2} | to nuon
|
||||
{a: 1, b: 5} | merge {c: 2} | to nuon --raw
|
||||
"#
|
||||
))
|
||||
.out,
|
||||
@ -61,7 +61,7 @@ fn single_record_overwrite() {
|
||||
nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
{a: 1, b: 2} | merge {a: 2} | to nuon
|
||||
{a: 1, b: 2} | merge {a: 2} | to nuon --raw
|
||||
"#
|
||||
))
|
||||
.out,
|
||||
@ -75,7 +75,7 @@ fn single_row_table_overwrite() {
|
||||
nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[[a b]; [1 4]] | merge [[a b]; [2 4]] | to nuon
|
||||
[[a b]; [1 4]] | merge [[a b]; [2 4]] | to nuon --raw
|
||||
"#
|
||||
))
|
||||
.out,
|
||||
@ -89,7 +89,7 @@ fn single_row_table_no_overwrite() {
|
||||
nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[[a b]; [1 4]] | merge [[c d]; [2 4]] | to nuon
|
||||
[[a b]; [1 4]] | merge [[c d]; [2 4]] | to nuon --raw
|
||||
"#
|
||||
))
|
||||
.out,
|
||||
@ -103,7 +103,7 @@ fn multi_row_table_no_overwrite() {
|
||||
nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[[a b]; [1 4] [8 9] [9 9]] | merge [[c d]; [2 4]] | to nuon
|
||||
[[a b]; [1 4] [8 9] [9 9]] | merge [[c d]; [2 4]] | to nuon --raw
|
||||
"#
|
||||
))
|
||||
.out,
|
||||
@ -117,7 +117,7 @@ fn multi_row_table_overwrite() {
|
||||
nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[[a b]; [1 4] [8 9] [9 9]] | merge [[a b]; [7 7]] | to nuon
|
||||
[[a b]; [1 4] [8 9] [9 9]] | merge [[a b]; [7 7]] | to nuon --raw
|
||||
"#
|
||||
))
|
||||
.out,
|
||||
|
@ -101,7 +101,7 @@ fn mut_path_insert_list() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
mut a = [0 1 2]; $a.3 = 3; $a | to nuon
|
||||
mut a = [0 1 2]; $a.3 = 3; $a | to nuon --raw
|
||||
"#
|
||||
));
|
||||
|
||||
@ -125,7 +125,7 @@ fn mut_path_upsert_list() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
mut a = [[[3] 2] 1]; $a.0.0.1 = 0; $a.0.2 = 0; $a.2 = 0; $a | to nuon
|
||||
mut a = [[[3] 2] 1]; $a.0.0.1 = 0; $a.0.2 = 0; $a.2 = 0; $a | to nuon --raw
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -178,7 +178,7 @@ fn select_ignores_errors_successfully2() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
[{a: 1} {a: 2} {a: 3}] | select -i b | to nuon
|
||||
[{a: 1} {a: 2} {a: 3}] | select -i b | to nuon --raw
|
||||
"#
|
||||
));
|
||||
|
||||
@ -190,7 +190,7 @@ fn select_ignores_errors_successfully2() {
|
||||
fn select_ignores_errors_successfully3() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"sys | select -i invalid_key | to nuon"#
|
||||
r#"sys | select -i invalid_key | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "{invalid_key: null}".to_string());
|
||||
@ -201,7 +201,7 @@ fn select_ignores_errors_successfully3() {
|
||||
fn select_ignores_errors_successfully4() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"[a b c] | select -i invalid_key | to nuon"#
|
||||
r#"[a b c] | select -i invalid_key | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(
|
||||
@ -226,7 +226,7 @@ fn select_ignores_errors_successfully5() {
|
||||
fn select_ignores_errors_successfully6() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#""key val\na 1\nb 2\n" | lines | split column -c " " | select -i "100" | to nuon"#
|
||||
r#""key val\na 1\nb 2\n" | lines | split column -c " " | select -i "100" | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(
|
||||
|
@ -50,7 +50,7 @@ fn sort_different_types() {
|
||||
fn sort_natural() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"['1' '2' '3' '4' '5' '10' '100'] | sort -n | to nuon"#
|
||||
r#"['1' '2' '3' '4' '5' '10' '100'] | sort -n | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, r#"["1", "2", "3", "4", "5", "10", "100"]"#);
|
||||
@ -60,7 +60,7 @@ fn sort_natural() {
|
||||
fn sort_record_natural() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"{10:0,99:0,1:0,9:0,100:0} | sort -n | to nuon"#
|
||||
r#"{10:0,99:0,1:0,9:0,100:0} | sort -n | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(
|
||||
@ -73,7 +73,7 @@ fn sort_record_natural() {
|
||||
fn sort_record_insensitive() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"{abe:1,zed:2,ABE:3} | sort -i | to nuon"#
|
||||
r#"{abe:1,zed:2,ABE:3} | sort -i | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, r#"{abe: 1, ABE: 3, zed: 2}"#);
|
||||
@ -83,7 +83,7 @@ fn sort_record_insensitive() {
|
||||
fn sort_record_insensitive_reverse() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"{abe:1,zed:2,ABE:3} | sort -ir | to nuon"#
|
||||
r#"{abe:1,zed:2,ABE:3} | sort -ir | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, r#"{zed: 2, ABE: 3, abe: 1}"#);
|
||||
@ -93,7 +93,7 @@ fn sort_record_insensitive_reverse() {
|
||||
fn sort_record_values_natural() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"{1:"1",2:"2",4:"100",3:"10"} | sort -vn | to nuon"#
|
||||
r#"{1:"1",2:"2",4:"100",3:"10"} | sort -vn | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, r#"{"1": "1", "2": "2", "3": "10", "4": "100"}"#);
|
||||
@ -103,7 +103,7 @@ fn sort_record_values_natural() {
|
||||
fn sort_record_values_insensitive() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"{1:abe,2:zed,3:ABE} | sort -vi | to nuon"#
|
||||
r#"{1:abe,2:zed,3:ABE} | sort -vi | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, r#"{"1": abe, "3": ABE, "2": zed}"#);
|
||||
@ -113,7 +113,7 @@ fn sort_record_values_insensitive() {
|
||||
fn sort_record_values_insensitive_reverse() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"{1:abe,2:zed,3:ABE} | sort -vir | to nuon"#
|
||||
r#"{1:abe,2:zed,3:ABE} | sort -vir | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, r#"{"2": zed, "3": ABE, "1": abe}"#);
|
||||
|
@ -17,7 +17,7 @@ fn sets_the_column() {
|
||||
#[test]
|
||||
fn doesnt_convert_record_to_table() {
|
||||
let actual = nu!(
|
||||
cwd: ".", r#"{a:1} | update a 2 | to nuon"#
|
||||
cwd: ".", r#"{a:1} | update a 2 | to nuon --raw"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "{a: 2}");
|
||||
@ -119,7 +119,7 @@ fn update_nonexistent_column() {
|
||||
fn update_uses_enumerate_index() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"[[a]; [7] [6]] | enumerate | update item.a {|el| $el.index + 1 + $el.item.a } | flatten | to nuon"#
|
||||
r#"[[a]; [7] [6]] | enumerate | update item.a {|el| $el.index + 1 + $el.item.a } | flatten | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "[[index, a]; [0, 8], [1, 8]]");
|
||||
|
@ -17,7 +17,7 @@ fn sets_the_column() {
|
||||
#[test]
|
||||
fn doesnt_convert_record_to_table() {
|
||||
let actual = nu!(
|
||||
cwd: ".", r#"{a:1} | upsert a 2 | to nuon"#
|
||||
cwd: ".", r#"{a:1} | upsert a 2 | to nuon --raw"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "{a: 2}");
|
||||
@ -72,7 +72,7 @@ fn sets_the_column_from_a_subexpression() {
|
||||
fn upsert_uses_enumerate_index_inserting() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"[[a]; [7] [6]] | enumerate | upsert b {|el| $el.index + 1 + $el.item.a } | flatten | to nuon"#
|
||||
r#"[[a]; [7] [6]] | enumerate | upsert b {|el| $el.index + 1 + $el.item.a } | flatten | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "[[index, a, b]; [0, 7, 8], [1, 6, 8]]");
|
||||
@ -82,7 +82,7 @@ fn upsert_uses_enumerate_index_inserting() {
|
||||
fn upsert_uses_enumerate_index_updating() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"[[a]; [7] [6]] | enumerate | upsert a {|el| $el.index + 1 + $el.item.a } | flatten | to nuon"#
|
||||
r#"[[a]; [7] [6]] | enumerate | upsert a {|el| $el.index + 1 + $el.item.a } | flatten | to nuon --raw"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "[[index, a]; [0, 8], [1, 8]]");
|
||||
|
@ -35,7 +35,7 @@ fn where_inside_block_works() {
|
||||
fn filters_with_0_arity_block() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
"[1 2 3 4] | where { $in < 3 } | to nuon"
|
||||
"[1 2 3 4] | where { $in < 3 } | to nuon --raw"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "[1, 2]");
|
||||
@ -45,7 +45,7 @@ fn filters_with_0_arity_block() {
|
||||
fn filters_with_1_arity_block() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
"[1 2 3 6 7 8] | where {|e| $e < 5 } | to nuon"
|
||||
"[1 2 3 6 7 8] | where {|e| $e < 5 } | to nuon --raw"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "[1, 2, 3]");
|
||||
@ -55,7 +55,7 @@ fn filters_with_1_arity_block() {
|
||||
fn unique_env_each_iteration() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"[1 2] | where { print ($env.PWD | str ends-with 'formats') | cd '/' | true } | to nuon"
|
||||
"[1 2] | where { print ($env.PWD | str ends-with 'formats') | cd '/' | true } | to nuon --raw"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "truetrue[1, 2]");
|
||||
@ -85,7 +85,7 @@ fn where_not_in_table() {
|
||||
fn where_uses_enumerate_index() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"[7 8 9 10] | enumerate | where {|el| $el.index < 2 } | to nuon"#
|
||||
r#"[7 8 9 10] | enumerate | where {|el| $el.index < 2 } | to nuon --raw"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "[[index, item]; [0, 7], [1, 8]]");
|
||||
|
@ -80,7 +80,7 @@ fn test_no_color_flag() {
|
||||
fn test_list() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"to html --list | where name == C64 | get 0 | to nuon"#
|
||||
r#"to html --list | where name == C64 | get 0 | to nuon --raw"#
|
||||
);
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
|
@ -457,14 +457,14 @@ fn does_not_quote_strings_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
|
||||
let test = [["a", "b", "c d"]; [1 2 3] [4 5 6]]; $test | to nuon --raw
|
||||
"#
|
||||
));
|
||||
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
|
||||
let a = {"ro name": "sam" rank: 10}; $a | to nuon --raw
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual.out, "{\"ro name\": sam, rank: 10}");
|
||||
|
@ -34,7 +34,7 @@ fn filesize_metric_overrides_format() {
|
||||
fn filesize_format_auto_metric_true() {
|
||||
let code = &[
|
||||
r#"let-env config = { filesize: { metric: true, format:"auto" } }"#,
|
||||
r#"[2mb 2gb 2tb] | into string | to nuon"#,
|
||||
r#"[2mb 2gb 2tb] | into string | to nuon --raw"#,
|
||||
];
|
||||
let actual = nu!(cwd: ".", nu_repl_code( code ));
|
||||
assert_eq!(actual.out, r#"["2.0 MB", "2.0 GB", "2.0 TB"]"#);
|
||||
@ -44,7 +44,7 @@ fn filesize_format_auto_metric_true() {
|
||||
fn filesize_format_auto_metric_false() {
|
||||
let code = &[
|
||||
r#"let-env config = { filesize: { metric: false, format:"auto" } }"#,
|
||||
r#"[2mb 2gb 2tb] | into string | to nuon"#,
|
||||
r#"[2mb 2gb 2tb] | into string | to nuon --raw"#,
|
||||
];
|
||||
let actual = nu!(cwd: ".", nu_repl_code( code ));
|
||||
assert_eq!(actual.out, r#"["1.9 MiB", "1.9 GiB", "1.8 TiB"]"#);
|
||||
|
@ -148,7 +148,7 @@ fn bad_var_name2() -> TestResult {
|
||||
#[test]
|
||||
fn long_flag() -> TestResult {
|
||||
run_test(
|
||||
r#"([a, b, c] | enumerate | each --keep-empty { |e| if $e.index != 1 { 100 }}).1 | to nuon"#,
|
||||
r#"([a, b, c] | enumerate | each --keep-empty { |e| if $e.index != 1 { 100 }}).1 | to nuon --raw"#,
|
||||
"null",
|
||||
)
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ fn length_defaulted_columns() -> TestResult {
|
||||
fn nullify_errors() -> TestResult {
|
||||
run_test("([{a:1} {a:2} {a:3}] | get -i foo | length) == 3", "true")?;
|
||||
run_test(
|
||||
"([{a:1} {a:2} {a:3}] | get -i foo | to nuon) == '[null, null, null]'",
|
||||
"([{a:1} {a:2} {a:3}] | get -i foo | to nuon --raw) == '[null, null, null]'",
|
||||
"true",
|
||||
)
|
||||
}
|
||||
@ -267,7 +267,7 @@ fn nullify_errors() -> TestResult {
|
||||
#[test]
|
||||
fn nullify_holes() -> TestResult {
|
||||
run_test(
|
||||
"([{a:1} {b:2} {a:3}] | get -i a | to nuon) == '[1, null, 3]'",
|
||||
"([{a:1} {b:2} {a:3}] | get -i a | to nuon --raw) == '[1, null, 3]'",
|
||||
"true",
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user