| 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/inner_style_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 | table.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 | table.set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(85); |
| 9 | |
| 10 | let mut row = Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::newrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row]new().(); |
| 11 | row.add_cellrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row]add_cell().(Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!( |
| 12 | "hello{}cell1", |
| 13 | consolerust-analyzer cargo console 0.16.1 crate/::stylerust-analyzer cargo console 0.16.1 utils/style().("123\n456").dimrust-analyzer cargo console 0.16.1 utils/impl#[`StyledObject<D>`]dim().().bluerust-analyzer cargo console 0.16.1 utils/impl#[`StyledObject<D>`]blue().() |
| 14 | ))); |
| 15 | row.add_cellrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row]add_cell().(Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("cell2")); |
| 16 | |
| 17 | table.add_rowrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row().(row); |
| 18 | |
| 19 | let mut row = Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::newrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row]new().(); |
| 20 | row.add_cellrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row]add_cell().(Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().( |
| 21 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(r"cell sys-devices-pci00:00-0000:000:07:00.1-usb2-2\x2d1-2\x2d1.3-2\x2d1.3:1.0-host2-target2:0:0-2:0:0:1-block-sdb{}", consolerust-analyzer cargo console 0.16.1 crate/::stylerust-analyzer cargo console 0.16.1 utils/style().(".device").boldrust-analyzer cargo console 0.16.1 utils/impl#[`StyledObject<D>`]bold().().redrust-analyzer cargo console 0.16.1 utils/impl#[`StyledObject<D>`]red().()) |
| 22 | )); |
| 23 | row.add_cellrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row]add_cell().(Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().( |
| 24 | "cell4 asdfasfsad asdfasdf sad fas df asdf as df asdf asdfasdfasdfasdfasdfasdfa dsfa sdf asdf asd f asdf as df sadf asd fas df " |
| 25 | )); |
| 26 | table.add_rowrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row().(row); |
| 27 | |
| 28 | let mut row = Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::newrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row]new().(); |
| 29 | row.add_cellrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row]add_cell().(Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("cell5")); |
| 30 | row.add_cellrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row]add_cell().(Cellrust-analyzer cargo comfy-table 7.2.2 cell/Cell#::newrust-analyzer cargo comfy-table 7.2.2 cell/impl#[Cell]new().("cell6")); |
| 31 | table.add_rowrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row().(row); |
| 32 | |
| 33 | table |
| 34 | } |
| 35 | |
| 36 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 37 | fn styled_tablerust-analyzer cargo comfy-table 7.2.2 all/inner_style_test/styled_table().() { |
| 38 | consolerust-analyzer cargo console 0.16.1 crate/::set_colors_enabledrust-analyzer cargo console 0.16.1 utils/set_colors_enabled().(true); |
| 39 | let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/inner_style_test/get_preset_table().(); |
| 40 | 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().(); |
| 41 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 42 | let expected = " |
| 43 | ┌─────────────────────────────────────────┬─────────────────────────────────────────┐ |
| 44 | │ hello\u{1b}[34m\u{1b}[2m123\u{1b}[0m ┆ cell2 │ |
| 45 | │ \u{1b}[34m\u{1b}[2m456\u{1b}[0mcell1 ┆ │ |
| 46 | ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ |
| 47 | │ cell sys-devices-pci00:00-0000:000:07:0 ┆ cell4 asdfasfsad asdfasdf sad fas df │ |
| 48 | │ 0.1-usb2-2\\x2d1-2\\x2d1.3-2\\x2d1.3:1.0-h ┆ asdf as df asdf │ |
| 49 | │ ost2-target2:0:0-2:0:0:1-block-sdb\u{1b}[31m\u{1b}[1m.devi\u{1b}[0m ┆ asdfasdfasdfasdfasdfasdfa dsfa sdf asdf │ |
| 50 | │ \u{1b}[31m\u{1b}[1mce\u{1b}[0m ┆ asd f asdf as df sadf asd fas df │ |
| 51 | ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ |
| 52 | │ cell5 ┆ cell6 │ |
| 53 | └─────────────────────────────────────────┴─────────────────────────────────────────┘"; |
| 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 | } |
| 56 | |
| 57 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 58 | fn no_style_styled_tablerust-analyzer cargo comfy-table 7.2.2 all/inner_style_test/no_style_styled_table().() { |
| 59 | consolerust-analyzer cargo console 0.16.1 crate/::set_colors_enabledrust-analyzer cargo console 0.16.1 utils/set_colors_enabled().(true); |
| 60 | let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/inner_style_test/get_preset_table().(); |
| 61 | table.force_no_ttyrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]force_no_tty().(); |
| 62 | |
| 63 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 64 | let expected = " |
| 65 | ┌─────────────────────────────────────────┬─────────────────────────────────────────┐ |
| 66 | │ hello\u{1b}[34m\u{1b}[2m123\u{1b}[0m ┆ cell2 │ |
| 67 | │ \u{1b}[34m\u{1b}[2m456\u{1b}[0mcell1 ┆ │ |
| 68 | ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ |
| 69 | │ cell sys-devices-pci00:00-0000:000:07:0 ┆ cell4 asdfasfsad asdfasdf sad fas df │ |
| 70 | │ 0.1-usb2-2\\x2d1-2\\x2d1.3-2\\x2d1.3:1.0-h ┆ asdf as df asdf │ |
| 71 | │ ost2-target2:0:0-2:0:0:1-block-sdb\u{1b}[31m\u{1b}[1m.devi\u{1b}[0m ┆ asdfasdfasdfasdfasdfasdfa dsfa sdf asdf │ |
| 72 | │ \u{1b}[31m\u{1b}[1mce\u{1b}[0m ┆ asd f asdf as df sadf asd fas df │ |
| 73 | ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ |
| 74 | │ cell5 ┆ cell6 │ |
| 75 | └─────────────────────────────────────────┴─────────────────────────────────────────┘"; |
| 76 | 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().()); |
| 77 | } |
| 78 | |
| 79 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 80 | fn styled_text_only_tablerust-analyzer cargo comfy-table 7.2.2 all/inner_style_test/styled_text_only_table().() { |
| 81 | consolerust-analyzer cargo console 0.16.1 crate/::set_colors_enabledrust-analyzer cargo console 0.16.1 utils/set_colors_enabled().(true); |
| 82 | let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/inner_style_test/get_preset_table().(); |
| 83 | 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().().style_text_onlyrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]style_text_only().(); |
| 84 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 85 | let expected = " |
| 86 | ┌─────────────────────────────────────────┬─────────────────────────────────────────┐ |
| 87 | │ hello\u{1b}[34m\u{1b}[2m123\u{1b}[0m ┆ cell2 │ |
| 88 | │ \u{1b}[34m\u{1b}[2m456\u{1b}[0mcell1 ┆ │ |
| 89 | ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ |
| 90 | │ cell sys-devices-pci00:00-0000:000:07:0 ┆ cell4 asdfasfsad asdfasdf sad fas df │ |
| 91 | │ 0.1-usb2-2\\x2d1-2\\x2d1.3-2\\x2d1.3:1.0-h ┆ asdf as df asdf │ |
| 92 | │ ost2-target2:0:0-2:0:0:1-block-sdb\u{1b}[31m\u{1b}[1m.devi\u{1b}[0m ┆ asdfasdfasdfasdfasdfasdfa dsfa sdf asdf │ |
| 93 | │ \u{1b}[31m\u{1b}[1mce\u{1b}[0m ┆ asd f asdf as df sadf asd fas df │ |
| 94 | ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ |
| 95 | │ cell5 ┆ cell6 │ |
| 96 | └─────────────────────────────────────────┴─────────────────────────────────────────┘"; |
| 97 | 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().()); |
| 98 | } |