File: modifiers_test.rs

package info (click to toggle)
rust-comfy-table 7.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 612 kB
  • sloc: makefile: 2
file content (34 lines) | stat: -rw-r--r-- 1,186 bytes parent folder | download | duplicates (2)
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
use pretty_assertions::assert_eq;

use comfy_table::modifiers::*;
use comfy_table::presets::*;
use comfy_table::*;

fn get_preset_table() -> Table {
    let mut table = Table::new();
    table
        .set_header(vec!["Header1", "Header2", "Header3"])
        .add_row(vec!["One One", "One Two", "One Three"])
        .add_row(vec!["One One", "One Two", "One Three"]);

    table
}

#[test]
fn utf8_round_corners() {
    let mut table = get_preset_table();
    table
        .load_preset(UTF8_FULL)
        .apply_modifier(UTF8_ROUND_CORNERS);
    let expected = "
╭─────────┬─────────┬───────────╮
│ Header1 ┆ Header2 ┆ Header3   │
╞═════════╪═════════╪═══════════╡
│ One One ┆ One Two ┆ One Three │
├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
│ One One ┆ One Two ┆ One Three │
╰─────────┴─────────┴───────────╯";

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