1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Assert module contains a help macros to compare and test tables conveniently.
/// Create a test function for table assertion.
///
/// # Example
///
/// ```
/// # fn main() {}
///
/// use tabled::Table;
/// use tabled::assert::test_table;
///
/// test_table!(
/// test_table,
/// Table::new([[1, 2, 3], [4, 5, 6]]),
/// "+---+---+---+"
/// "| 0 | 1 | 2 |"
/// "+---+---+---+"
/// "| 1 | 2 | 3 |"
/// "+---+---+---+"
/// "| 4 | 5 | 6 |"
/// "+---+---+---+"
/// );
/// ```
pub use test_table;
/// Assert a table.
///
/// It's an analog of [`assert_eq`] but for tables.
///
/// # Example
///
/// ```
/// use tabled::Table;
/// use tabled::assert::assert_table;
///
/// let data = [[1, 2, 3], [4, 5, 6]];
/// let table = Table::new(data);
///
/// assert_table!(
/// table,
/// "+---+---+---+"
/// "| 0 | 1 | 2 |"
/// "+---+---+---+"
/// "| 1 | 2 | 3 |"
/// "+---+---+---+"
/// "| 4 | 5 | 6 |"
/// "+---+---+---+"
/// );
/// ```
pub use assert_table;
/// Assert table width.
///
/// # Example
///
/// ```
/// use tabled::Table;
/// use tabled::assert::assert_width;
///
/// let data = [[1, 2, 3], [4, 5, 6]];
/// let table = Table::new(data);
///
/// assert_width!(table, 13);
/// ```
pub use assert_width;
/// Construct a static table.
///
/// Usefull for assert functions.
///
/// # Example
///
/// ```
/// use tabled::Table;
/// use tabled::assert::static_table;
///
/// let data = [[1, 2, 3], [4, 5, 6]];
/// let table = Table::new(data);
///
/// assert_eq!(
/// table.to_string(),
/// static_table!(
/// "+---+---+---+"
/// "| 0 | 1 | 2 |"
/// "+---+---+---+"
/// "| 1 | 2 | 3 |"
/// "+---+---+---+"
/// "| 4 | 5 | 6 |"
/// "+---+---+---+"
/// ),
/// );
/// ```
pub use static_table;