| 1 | use comfy_tablerust-analyzer cargo comfy-table 7.2.2 crate/::*; |
| 2 | |
| 3 | /// A gigantic table can generated, even if it's longer than the longest supported width. |
| 4 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 5 | fn giant_tablerust-analyzer cargo comfy-table 7.2.2 all/edge_cases/giant_table().() { |
| 6 | 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().(); |
| 7 | table.set_headerrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_header().(["a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(1_000_000)]); |
| 8 | table.add_rowrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row().(["a".repeatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]repeat().(1_000_000)]); |
| 9 | |
| 10 | table.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 11 | } |
| 12 | |
| 13 | /// No panic, even if there's a ridiculous amount of padding. |
| 14 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 15 | fn max_paddingrust-analyzer cargo comfy-table 7.2.2 all/edge_cases/max_padding().() { |
| 16 | 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().(); |
| 17 | table.add_rowrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row().(["test"]); |
| 18 | let column = table.column_mutrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]column_mut().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 19 | |
| 20 | column.set_paddingrust-analyzer cargo comfy-table 7.2.2 column/impl#[Column]set_padding().((u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX., u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX.)); |
| 21 | |
| 22 | table.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(); |
| 23 | } |