mirror of
https://gitlab.com/arnekeller/ascii-table.git
synced 2024-12-04 21:49:08 +00:00
save game
This commit is contained in:
parent
d6d7d94df0
commit
ad96a42926
17
src/test.rs
17
src/test.rs
@ -18,6 +18,8 @@
|
||||
use crate::{TableConfig, ColumnConfig, format_table};
|
||||
use crate::Align::{Left, Right, Center};
|
||||
|
||||
use std::fmt::Display;
|
||||
|
||||
fn cube_config() -> TableConfig {
|
||||
let mut result = TableConfig::default();
|
||||
result.columns.insert(0, ColumnConfig::new("a", Left));
|
||||
@ -379,3 +381,18 @@ fn align_center() {
|
||||
|
||||
assert_eq!(expected, format_table(input, &config));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mixed_types() {
|
||||
let config = cube_config();
|
||||
let input: Vec<Vec<&dyn Display>> = vec![vec![&1, &'2', &"3"], vec![&"4", &5, &'6'], vec![&'7', &"8", &9]];
|
||||
let expected = "┌───┬───┬───┐\n\
|
||||
│ a │ b │ c │\n\
|
||||
├───┼───┼───┤\n\
|
||||
│ 1 │ 2 │ 3 │\n\
|
||||
│ 4 │ 5 │ 6 │\n\
|
||||
│ 7 │ 8 │ 9 │\n\
|
||||
└───┴───┴───┘\n";
|
||||
|
||||
assert_eq!(expected, format_table(input, &config));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user