Debian Codegraph @

tests/all/modifiers_test.rs

raw symbols SCIP
1 use comfy_table::{modifiers::*, presets::*, *};
2 use pretty_assertions::assert_eq;
3
4 fn get_preset_table() -> Table {
5 let mut table = Table::new();
6 table
7 .set_header(vec!["Header1", "Header2", "Header3"])
8 .add_row(vec!["One One", "One Two", "One Three"])
9 .add_row(vec!["One One", "One Two", "One Three"]);
10
11 table
12 }
13
14 #[test]
15 fn utf8_round_corners() {
16 let mut table = get_preset_table();
17 table
18 .load_preset(UTF8_FULL)
19 .apply_modifier(UTF8_ROUND_CORNERS);
20 let expected = "
21 ╭─────────┬─────────┬───────────╮
22 │ Header1 ┆ Header2 ┆ Header3 │
23 ╞═════════╪═════════╪═══════════╡
24 │ One One ┆ One Two ┆ One Three │
25 ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
26 │ One One ┆ One Two ┆ One Three │
27 ╰─────────┴─────────┴───────────╯";
28
29 println!("{table}");
30 assert_eq!(expected, "\n".to_string() + &table.to_string());
31 }