Debian Codegraph @

tests/all/content_arrangement_test.rs

raw symbols SCIP
1 use comfy_tablerust-analyzer cargo comfy-table 7.2.2 crate/::{ColumnConstraintrust-analyzer cargo comfy-table 7.2.2 style/column/ColumnConstraint#, ContentArrangementrust-analyzer cargo comfy-table 7.2.2 style/table/ContentArrangement#, Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#, Widthrust-analyzer cargo comfy-table 7.2.2 style/column/Width#};
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 use superrust-analyzer cargo comfy-table 7.2.2 all/::assert_table_line_widthrust-analyzer cargo comfy-table 7.2.2 all/assert_table_line_width().;
5
6 /// Test the robustness of the dynamic table arrangement.
7 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
8 fn simple_dynamic_tablerust-analyzer cargo comfy-table 7.2.2 all/content_arrangement_test/simple_dynamic_table().() {
9 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().();
10 table.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!!["Header1", "Header2", "Head"])
11 .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#)
12 .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(25)
13 .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!![
14 "This is a very long line with a lot of text",
15 "This is anotherverylongtextwithlongwords text",
16 "smol",
17 ])
18 .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!![
19 "This is another text",
20 "Now let's\nadd a really long line in the middle of the cell \n and add more multi line stuff",
21 "smol",
22 ]);
23
24 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
25 let expected = "
26 +--------+-------+------+
27 | Header | Heade | Head |
28 | 1 | r2 | |
29 +=======================+
30 | This | This | smol |
31 | is a | is | |
32 | very | anoth | |
33 | long | erver | |
34 | line | ylong | |
35 | with a | textw | |
36 | lot of | ithlo | |
37 | text | ngwor | |
38 | | ds | |
39 | | text | |
40 |--------+-------+------|
41 | This | Now | smol |
42 | is ano | let's | |
43 | ther | add a | |
44 | text | reall | |
45 | | y | |
46 | | long | |
47 | | line | |
48 | | in | |
49 | | the | |
50 | | middl | |
51 | | e of | |
52 | | the | |
53 | | cell | |
54 | | and | |
55 | | add | |
56 | | more | |
57 | | multi | |
58 | | line | |
59 | | stuff | |
60 +--------+-------+------+";
61 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
62 assert_table_line_widthrust-analyzer cargo comfy-table 7.2.2 all/assert_table_line_width().(&table, 25);
63 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().());
64 }
65
66 /// This table checks the scenario, where a column has a big max_width, but a lot of the assigned
67 /// space doesn't get used after splitting the lines. This happens mostly when there are
68 /// many long words in a single column.
69 /// The remaining space should rather be distributed to other cells.
70 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
71 fn distribute_space_after_splitrust-analyzer cargo comfy-table 7.2.2 all/content_arrangement_test/distribute_space_after_split().() {
72 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().();
73 table
74 .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!!["Header1", "Header2", "Head"])
75 .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#)
76 .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(80)
77 .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!![
78 "This is a very long line with a lot of text",
79 "This is text with a anotherverylongtexttesttest",
80 "smol",
81 ]);
82
83 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
84 let expected = "
85 +-----------------------------------------+-----------------------------+------+
86 | Header1 | Header2 | Head |
87 +==============================================================================+
88 | This is a very long line with a lot of | This is text with a | smol |
89 | text | anotherverylongtexttesttest | |
90 +-----------------------------------------+-----------------------------+------+";
91 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
92
93 assert_table_line_widthrust-analyzer cargo comfy-table 7.2.2 all/assert_table_line_width().(&table, 80);
94 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().());
95 }
96
97 /// A single column get's split and a lot of the available isn't used afterward.
98 /// The remaining space should be cut away, making the table more compact.
99 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
100 fn unused_space_after_splitrust-analyzer cargo comfy-table 7.2.2 all/content_arrangement_test/unused_space_after_split().() {
101 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().();
102 table
103 .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!!["Header1"])
104 .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#)
105 .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(30)
106 .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!!["This is text with a anotherverylongtext"]);
107
108 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
109 let expected = "
110 +---------------------+
111 | Header1 |
112 +=====================+
113 | This is text with a |
114 | anotherverylongtext |
115 +---------------------+";
116 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
117 assert_table_line_widthrust-analyzer cargo comfy-table 7.2.2 all/assert_table_line_width().(&table, 23);
118 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().());
119 }
120
121 /// The full width of a table should be used, even if the space isn't used.
122 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
123 fn dynamic_full_width_after_splitrust-analyzer cargo comfy-table 7.2.2 all/content_arrangement_test/dynamic_full_width_after_split().() {
124 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().();
125 table
126 .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!!["Header1"])
127 .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#::DynamicFullWidthrust-analyzer cargo comfy-table 7.2.2 style/table/ContentArrangement#DynamicFullWidth#)
128 .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(50)
129 .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!!["This is text with a anotherverylongtexttesttestaa"]);
130
131 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
132 let expected = "
133 +------------------------------------------------+
134 | Header1 |
135 +================================================+
136 | This is text with a |
137 | anotherverylongtexttesttestaa |
138 +------------------------------------------------+";
139 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
140 assert_table_line_widthrust-analyzer cargo comfy-table 7.2.2 all/assert_table_line_width().(&table, 50);
141 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().());
142 }
143
144 /// This table checks the scenario, where a column has a big max_width, but a lot of the assigned
145 /// space isn't used after splitting the lines.
146 /// The remaining space should rather distributed between all cells.
147 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
148 fn dynamic_full_widthrust-analyzer cargo comfy-table 7.2.2 all/content_arrangement_test/dynamic_full_width().() {
149 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().();
150 table
151 .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!!["Header1", "Header2", "smol"])
152 .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#::DynamicFullWidthrust-analyzer cargo comfy-table 7.2.2 style/table/ContentArrangement#DynamicFullWidth#)
153 .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(80)
154 .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!!["This is a short line", "small", "smol"]);
155
156 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
157 let expected = "
158 +-----------------------------------+----------------------+-------------------+
159 | Header1 | Header2 | smol |
160 +==============================================================================+
161 | This is a short line | small | smol |
162 +-----------------------------------+----------------------+-------------------+";
163 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
164 assert_table_line_widthrust-analyzer cargo comfy-table 7.2.2 all/assert_table_line_width().(&table, 80);
165 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().());
166 }
167
168 /// Test that a table is displayed in its full width, if the `table.width` is set to the exact
169 /// width the table has, if it's fully expanded.
170 ///
171 /// The same should be the case for values that are larger than this width.
172 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
173 fn dynamic_exact_widthrust-analyzer cargo comfy-table 7.2.2 all/content_arrangement_test/dynamic_exact_width().() {
174 let header = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a\n---\ni64", "b\n---\ni64", "b_squared\n---\nf64"];
175 let rows = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
176 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["1", "2", "4.0"],
177 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["3", "4", "16.0"],
178 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["5", "6", "36.0"],
179 ];
180
181 for width in 25..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#40 {
182 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().();
183 let table = table
184 .load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(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.)
185 .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#)
186 .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(width);
187
188 table.set_headerrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_header().(header.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().()).add_rowsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_rows().(rows.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().());
189
190 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
191 let expected = "
192 ┌─────┬─────┬───────────┐
193 │ a ┆ b ┆ b_squared │
194 │ --- ┆ --- ┆ --- │
195 │ i64 ┆ i64 ┆ f64 │
196 ╞═════╪═════╪═══════════╡
197 │ 1 ┆ 2 ┆ 4.0 │
198 ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
199 │ 3 ┆ 4 ┆ 16.0 │
200 ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┤
201 │ 5 ┆ 6 ┆ 36.0 │
202 └─────┴─────┴───────────┘";
203 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
204 assert_table_line_widthrust-analyzer cargo comfy-table 7.2.2 all/assert_table_line_width().(table, 25);
205 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().());
206 }
207 }
208
209 /// Test that the formatting works as expected, if the table is slightly smaller than the max width
210 /// of the table.
211 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
212 fn dynamic_slightly_smallerrust-analyzer cargo comfy-table 7.2.2 all/content_arrangement_test/dynamic_slightly_smaller().() {
213 let header = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a\n---\ni64", "b\n---\ni64", "b_squared\n---\nf64"];
214 let rows = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
215 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["1", "2", "4.0"],
216 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["3", "4", "16.0"],
217 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["5", "6", "36.0"],
218 ];
219
220 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().();
221 let table = table
222 .load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(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.)
223 .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#)
224 .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(24);
225
226 table.set_headerrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_header().(header.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().()).add_rowsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_rows().(rows.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().());
227
228 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
229 let expected = "
230 ┌─────┬─────┬──────────┐
231 │ a ┆ b ┆ b_square │
232 │ --- ┆ --- ┆ d │
233 │ i64 ┆ i64 ┆ --- │
234 │ ┆ ┆ f64 │
235 ╞═════╪═════╪══════════╡
236 │ 1 ┆ 2 ┆ 4.0 │
237 ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
238 │ 3 ┆ 4 ┆ 16.0 │
239 ├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
240 │ 5 ┆ 6 ┆ 36.0 │
241 └─────┴─────┴──────────┘";
242 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
243 assert_table_line_widthrust-analyzer cargo comfy-table 7.2.2 all/assert_table_line_width().(table, 24);
244 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().());
245 }
246
247 /// This failed on a python integration test case in the polars project.
248 /// This a regression test.
249 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
250 fn polar_python_test_tbl_width_charsrust-analyzer cargo comfy-table 7.2.2 all/content_arrangement_test/polar_python_test_tbl_width_chars().() {
251 let header = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
252 "a really long col\n---\ni64",
253 "b\n---\nstr",
254 "this is 10\n---\ni64",
255 ];
256 let rows = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
257 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["1", "", "4"],
258 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["2", "this is a string value that will...", "5"],
259 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["3", "null", "6"],
260 ];
261
262 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().();
263 let table = table
264 .load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(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.)
265 .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#)
266 .set_widthrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_width().(100)
267 .set_headerrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_header().(header)
268 .add_rowsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_rows().(rows)
269 .set_constraintsrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]set_constraints().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![
270 ColumnConstraintrust-analyzer cargo comfy-table 7.2.2 style/column/ColumnConstraint#::LowerBoundaryrust-analyzer cargo comfy-table 7.2.2 style/column/ColumnConstraint#LowerBoundary#(Widthrust-analyzer cargo comfy-table 7.2.2 style/column/Width#::Fixedrust-analyzer cargo comfy-table 7.2.2 style/column/Width#Fixed#(12)),
271 ColumnConstraintrust-analyzer cargo comfy-table 7.2.2 style/column/ColumnConstraint#::LowerBoundaryrust-analyzer cargo comfy-table 7.2.2 style/column/ColumnConstraint#LowerBoundary#(Widthrust-analyzer cargo comfy-table 7.2.2 style/column/Width#::Fixedrust-analyzer cargo comfy-table 7.2.2 style/column/Width#Fixed#(5)),
272 ColumnConstraintrust-analyzer cargo comfy-table 7.2.2 style/column/ColumnConstraint#::LowerBoundaryrust-analyzer cargo comfy-table 7.2.2 style/column/ColumnConstraint#LowerBoundary#(Widthrust-analyzer cargo comfy-table 7.2.2 style/column/Width#::Fixedrust-analyzer cargo comfy-table 7.2.2 style/column/Width#Fixed#(10)),
273 ]);
274
275 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
276 let expected = "
277 ┌───────────────────┬─────────────────────────────────────┬────────────┐
278 │ a really long col ┆ b ┆ this is 10 │
279 │ --- ┆ --- ┆ --- │
280 │ i64 ┆ str ┆ i64 │
281 ╞═══════════════════╪═════════════════════════════════════╪════════════╡
282 │ 1 ┆ ┆ 4 │
283 ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
284 │ 2 ┆ this is a string value that will... ┆ 5 │
285 ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
286 │ 3 ┆ null ┆ 6 │
287 └───────────────────┴─────────────────────────────────────┴────────────┘";
288 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
289 assert_table_line_widthrust-analyzer cargo comfy-table 7.2.2 all/assert_table_line_width().(table, 72);
290 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().());
291 }