feat(table): make missing value symbol configurable (#15647)

Co-authored-by: Bahex <17417311+Bahex@users.noreply.github.com>
This commit is contained in:
Bahex
2025-04-27 23:58:39 +03:00
committed by GitHub
parent 12ccaf5e33
commit d8bec8668f
6 changed files with 54 additions and 6 deletions

View File

@ -3359,3 +3359,36 @@ fn table_expand_big_header() {
╰───┴──────────────────────────────────────────────────────────────────────────╯"
);
}
#[test]
fn table_missing_value() {
let actual = nu!(r###"[{foo: null} {} {}] | table"###);
assert_eq!(
actual.out,
"╭───┬─────╮\
│ # │ foo │\
├───┼─────┤\
│ 0 │ │\
│ 1 │ ❎ │\
│ 2 │ ❎ │\
╰───┴─────╯",
)
}
#[test]
fn table_missing_value_custom() {
let actual = nu!(r###"
$env.config.table.missing_value_symbol = "NULL";
[{foo: null} {} {}] | table
"###);
assert_eq!(
actual.out,
"╭───┬──────╮\
│ # │ foo │\
├───┼──────┤\
│ 0 │ │\
│ 1 │ NULL │\
│ 2 │ NULL │\
╰───┴──────╯",
)
}