Debian Codegraph @

tests/all/presets_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/::*, *};
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/presets_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
7 .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!!["Hello", "there"])
8 .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!!["a", "b"])
9 .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!!["c", "d"]);
10
11 table
12 }
13
14 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
15 fn test_ascii_fullrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_ascii_full().() {
16 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
17 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(ASCII_FULLrust-analyzer cargo comfy-table 7.2.2 style/presets/ASCII_FULL.);
18 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
19 let expected = "
20 +-------+-------+
21 | Hello | there |
22 +===============+
23 | a | b |
24 |-------+-------|
25 | c | d |
26 +-------+-------+";
27 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
28 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().());
29 }
30
31 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
32 fn test_ascii_full_condensedrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_ascii_full_condensed().() {
33 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
34 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(ASCII_FULL_CONDENSEDrust-analyzer cargo comfy-table 7.2.2 style/presets/ASCII_FULL_CONDENSED.);
35 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
36 let expected = "
37 +-------+-------+
38 | Hello | there |
39 +===============+
40 | a | b |
41 | c | d |
42 +-------+-------+";
43 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
44 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
45 }
46
47 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
48 fn test_ascii_no_bordersrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_ascii_no_borders().() {
49 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
50 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(ASCII_NO_BORDERSrust-analyzer cargo comfy-table 7.2.2 style/presets/ASCII_NO_BORDERS.);
51 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
52 let expected = "
53 Hello | there
54 ===============
55 a | b
56 -------+-------
57 c | d";
58 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
59 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
60 }
61
62 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
63 fn test_ascii_borders_onlyrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_ascii_borders_only().() {
64 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
65 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(ASCII_BORDERS_ONLYrust-analyzer cargo comfy-table 7.2.2 style/presets/ASCII_BORDERS_ONLY.);
66 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
67 let expected = "
68 +---------------+
69 | Hello there |
70 +===============+
71 | a b |
72 | |
73 | c d |
74 +---------------+";
75 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
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 test_ascii_borders_only_condensedrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_ascii_borders_only_condensed().() {
81 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
82 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(ASCII_BORDERS_ONLY_CONDENSEDrust-analyzer cargo comfy-table 7.2.2 style/presets/ASCII_BORDERS_ONLY_CONDENSED.);
83 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
84 let expected = "
85 +---------------+
86 | Hello there |
87 +===============+
88 | a b |
89 | c d |
90 +---------------+";
91 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
92 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().());
93 }
94
95 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
96 fn test_ascii_horizontal_onlyrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_ascii_horizontal_only().() {
97 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
98 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(ASCII_HORIZONTAL_ONLYrust-analyzer cargo comfy-table 7.2.2 style/presets/ASCII_HORIZONTAL_ONLY.);
99 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
100 let expected = "
101 ---------------
102 Hello there
103 ===============
104 a b
105 ---------------
106 c d
107 ---------------";
108 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
109 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
110 }
111
112 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
113 fn test_ascii_markdownrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_ascii_markdown().() {
114 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
115 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(ASCII_MARKDOWNrust-analyzer cargo comfy-table 7.2.2 style/presets/ASCII_MARKDOWN.);
116 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
117 let expected = "
118 | Hello | there |
119 |-------|-------|
120 | a | b |
121 | c | d |";
122 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
123 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
124 }
125
126 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
127 fn test_utf8_fullrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_utf8_full().() {
128 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
129 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.);
130 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
131 let expected = "
132 ┌───────┬───────┐
133 │ Hello ┆ there │
134 ╞═══════╪═══════╡
135 │ a ┆ b │
136 ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤
137 │ c ┆ d │
138 └───────┴───────┘";
139 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
140 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
141 }
142
143 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
144 fn test_utf8_full_condensedrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_utf8_full_condensed().() {
145 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
146 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(UTF8_FULL_CONDENSEDrust-analyzer cargo comfy-table 7.2.2 style/presets/UTF8_FULL_CONDENSED.);
147 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
148 let expected = "
149 ┌───────┬───────┐
150 │ Hello ┆ there │
151 ╞═══════╪═══════╡
152 │ a ┆ b │
153 │ c ┆ d │
154 └───────┴───────┘";
155 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
156 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
157 }
158
159 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
160 fn test_utf8_no_bordersrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_utf8_no_borders().() {
161 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
162 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(UTF8_NO_BORDERSrust-analyzer cargo comfy-table 7.2.2 style/presets/UTF8_NO_BORDERS.);
163 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
164 let expected = "
165 Hello ┆ there
166 ═══════╪═══════
167 a ┆ b
168 ╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌
169 c ┆ d";
170 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
171 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
172 }
173
174 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
175 fn test_utf8_horizontal_onlyrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_utf8_horizontal_only().() {
176 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
177 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(UTF8_HORIZONTAL_ONLYrust-analyzer cargo comfy-table 7.2.2 style/presets/UTF8_HORIZONTAL_ONLY.);
178 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
179 let expected = "
180 ───────────────
181 Hello there
182 ═══════════════
183 a b
184 ───────────────
185 c d
186 ───────────────";
187 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
188 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
189 }
190
191 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
192 fn test_nothingrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_nothing().() {
193 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
194 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(NOTHINGrust-analyzer cargo comfy-table 7.2.2 style/presets/NOTHING.);
195 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
196 let expected = "
197 Hello there
198 a b
199 c d";
200 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
201 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
202 }
203
204 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
205 fn test_nothing_without_paddingrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_nothing_without_padding().() {
206 let mut table = get_preset_tablerust-analyzer cargo comfy-table 7.2.2 all/presets_test/get_preset_table().();
207 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().(NOTHINGrust-analyzer cargo comfy-table 7.2.2 style/presets/NOTHING.);
208 let column = table.column_iter_mutrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]column_iter_mut().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`IterMut<'a, T>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
209 column.set_paddingrust-analyzer cargo comfy-table 7.2.2 column/impl#[Column]set_padding().((0, 1));
210 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
211 let expected = "
212 Hello there
213 a b
214 c d";
215 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
216 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
217 }
218
219 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
220 fn test_no_vertical_stylingrust-analyzer cargo comfy-table 7.2.2 all/presets_test/test_no_vertical_styling().() {
221 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().();
222 table
223 .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!!["Hello", "there", "again"])
224 .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!!["a", "b", "something different"])
225 .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!!["omfg why though", "d", "f"]);
226
227 table.load_presetrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]load_preset().("|| - ");
228
229 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}");
230 let expected = "
231 | Hello there again |
232 ---------------------------------------------
233 | a b something different |
234 | omfg why though d f |";
235 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{expected}");
236 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.trim_fmtrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]trim_fmt().());
237 }