mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
nu-table/ Fix indexing issue for table --expand
(#9484)
close #9481 --------- Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
This commit is contained in:
@ -2369,3 +2369,19 @@ fn _split_str_by_width(s: &str, w: usize) -> Vec<String> {
|
||||
|
||||
lines
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn table_expand_index_offset() {
|
||||
let actual = nu!(r#"1..1002 | table --expand"#);
|
||||
let suffix = "╭──────┬──────╮│ 1000 │ 1001 ││ 1001 │ 1002 │╰──────┴──────╯";
|
||||
let expected_suffix = actual.out.strip_suffix(suffix);
|
||||
assert!(expected_suffix.is_some(), "{:?}", actual.out);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn table_index_offset() {
|
||||
let actual = nu!(r#"1..1002 | table"#);
|
||||
let suffix = "╭──────┬──────╮│ 1000 │ 1001 ││ 1001 │ 1002 │╰──────┴──────╯";
|
||||
let expected_suffix = actual.out.strip_suffix(suffix);
|
||||
assert!(expected_suffix.is_some(), "{:?}", actual.out);
|
||||
}
|
||||
|
Reference in New Issue
Block a user