Skip to content

Commit

Permalink
tests: Add empty table test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Oct 18, 2022
1 parent b5f725e commit 6cb3add
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/all/constraints_test.rs
Expand Up @@ -335,3 +335,23 @@ fn min_max_boundary() {
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
}

#[rstest::rstest]
#[case(ContentArrangement::Dynamic)]
#[case(ContentArrangement::Disabled)]
/// Empty table with zero width constraint.
fn empty_table(#[case] arrangement: ContentArrangement) {
let mut table = Table::new();
table
.add_row(vec![""])
.set_content_arrangement(arrangement)
.set_constraints(vec![Absolute(Fixed(0))]);

println!("{table}");
let expected = "
+---+
| |
+---+";
println!("{expected}");
assert_eq!("\n".to_string() + &table.to_string(), expected);
}

0 comments on commit 6cb3add

Please sign in to comment.