Debian Codegraph @

tests/all/combined_test.rs

raw symbols SCIP
1 use comfy_tablerust-analyzer cargo comfy-table 7.2.2 crate/::{presetsrust-analyzer cargo comfy-table 7.2.2 style/presets/::UTF8_FULLrust-analyzer cargo comfy-table 7.2.2 style/presets/UTF8_FULL., *};
2 use pretty_assertionsrust-analyzer cargo pretty_assertions 1.4.1 crate/::assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!;
3
4 fn get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/combined_test/get_preset_table().() -> Tablerust-analyzer cargo comfy-table 7.2.2 table/Table# {
5 let mut table = Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#::newrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]new().();
6 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(UTF8_FULLrust-analyzer cargo comfy-table 7.2.2 style/presets/UTF8_FULL.)
7 .set_content_arrangementrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_content_arrangement().(ContentArrangementrust-analyzer cargo comfy-table 7.2.2 style/table/ContentArrangement#::Dynamicrust-analyzer cargo comfy-table 7.2.2 style/table/ContentArrangement#Dynamic#)
8 .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(80)
9 .set_headerrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_header().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
10 Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("Header1").add_attributerust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]add_attribute().(Attributerust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#::Boldrust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#Bold#),
11 Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("Header2").fgrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]fg().(Colorrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#::Greenrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#Green#),
12 Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("Header3"),
13 ])
14 .add_rowrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
15 Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("This is a bold text").add_attributerust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]add_attribute().(Attributerust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#::Boldrust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#Bold#),
16 Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("This is a green text").fgrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]fg().(Colorrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#::Greenrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#Green#),
17 Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("This one has black background").bgrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]bg().(Colorrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#::Blackrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#Black#),
18 ])
19 .add_rowrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
20 Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("Blinky boi").add_attributerust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]add_attribute().(Attributerust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#::SlowBlinkrust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#SlowBlink#),
21 Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("This table's content is dynamically arranged. The table is exactly 80 characters wide.\nHere comes a reallylongwordthatshoulddynamicallywrap"),
22 Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("COMBINE ALL THE THINGS")
23 .fgrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]fg().(Colorrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#::Greenrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#Green#)
24 .bgrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]bg().(Colorrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#::Blackrust-analyzer cargo crossterm 0.29.0 style/types/color/Color#Black#)
25 .add_attributesrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]add_attributes().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
26 Attributerust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#::Boldrust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#Bold#,
27 Attributerust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#::SlowBlinkrust-analyzer cargo crossterm 0.29.0 style/types/attribute/Attribute#SlowBlink#,
28 ])
29 ]);
30
31 table
32 }
33
34 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
35 fn combined_featuresrust-analyzer cargo comfy-table 7.2.2 all/combined_test/combined_features().() {
36 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/combined_test/get_preset_table().();
37 table.force_no_ttyrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]force_no_tty().().enforce_stylingrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]enforce_styling().();
38 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
39 let expected = "
40 ┌─────────────────────┬───────────────────────────────┬────────────────────────┐
41 │\u{1b}[1m Header1 \u{1b}[0m┆\u{1b}[38;5;10m Header2 \u{1b}[39m┆ Header3 │
42 ╞═════════════════════╪═══════════════════════════════╪════════════════════════╡
43 │\u{1b}[1m This is a bold text \u{1b}[0m┆\u{1b}[38;5;10m This is a green text \u{1b}[39m┆\u{1b}[48;5;0m This one has black \u{1b}[49m│
44 │ ┆ ┆\u{1b}[48;5;0m background \u{1b}[49m│
45 ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
46 │\u{1b}[5m Blinky boi \u{1b}[0m┆ This table\'s content is ┆\u{1b}[48;5;0m\u{1b}[38;5;10m\u{1b}[1m\u{1b}[5m COMBINE ALL THE THINGS \u{1b}[0m│
47 │ ┆ dynamically arranged. The ┆ │
48 │ ┆ table is exactly 80 ┆ │
49 │ ┆ characters wide. ┆ │
50 │ ┆ Here comes a reallylongwordth ┆ │
51 │ ┆ atshoulddynamicallywrap ┆ │
52 └─────────────────────┴───────────────────────────────┴────────────────────────┘";
53 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
54 assert_eqrust-analyzer cargo pretty_assertions 1.4.1 assert_eq!!(expected, "\n".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). &table.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
55 }