save game

This commit is contained in:
Gerrit Viljoen 2019-12-26 14:36:16 +02:00
parent d6d7d94df0
commit ad96a42926

View File

@ -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));
}