| 1 | use comfy_tablerust-analyzer cargo comfy-table 7.2.2 crate/::*; |
| 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 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 5 | fn add_predicate_single_truerust-analyzer cargo comfy-table 7.2.2 all/add_predicate/add_predicate_single_true().() { |
| 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 |
| 8 | .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", "Header3"]) |
| 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!![ |
| 10 | "This is a text", |
| 11 | "This is another text", |
| 12 | "This is the third text", |
| 13 | ]) |
| 14 | .add_row_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row_if().( |
| 15 | |_, _| true, |
| 16 | &vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 17 | "This is another text", |
| 18 | "Now\nadd some\nmulti line stuff", |
| 19 | "This is awesome", |
| 20 | ], |
| 21 | ); |
| 22 | |
| 23 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 24 | let expected = " |
| 25 | +----------------------+----------------------+------------------------+ |
| 26 | | Header1 | Header2 | Header3 | |
| 27 | +======================================================================+ |
| 28 | | This is a text | This is another text | This is the third text | |
| 29 | |----------------------+----------------------+------------------------| |
| 30 | | This is another text | Now | This is awesome | |
| 31 | | | add some | | |
| 32 | | | multi line stuff | | |
| 33 | +----------------------+----------------------+------------------------+"; |
| 34 | 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().()); |
| 35 | } |
| 36 | |
| 37 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 38 | fn add_predicate_single_falserust-analyzer cargo comfy-table 7.2.2 all/add_predicate/add_predicate_single_false().() { |
| 39 | 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().(); |
| 40 | table |
| 41 | .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", "Header3"]) |
| 42 | .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!![ |
| 43 | "This is a text", |
| 44 | "This is another text", |
| 45 | "This is the third text", |
| 46 | ]) |
| 47 | .add_row_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row_if().( |
| 48 | |_, _| false, |
| 49 | &vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 50 | "This is another text", |
| 51 | "Now\nadd some\nmulti line stuff", |
| 52 | "This is awesome", |
| 53 | ], |
| 54 | ); |
| 55 | |
| 56 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 57 | let expected = " |
| 58 | +----------------+----------------------+------------------------+ |
| 59 | | Header1 | Header2 | Header3 | |
| 60 | +================================================================+ |
| 61 | | This is a text | This is another text | This is the third text | |
| 62 | +----------------+----------------------+------------------------+"; |
| 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 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 67 | fn add_predicate_single_mixedrust-analyzer cargo comfy-table 7.2.2 all/add_predicate/add_predicate_single_mixed().() { |
| 68 | 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().(); |
| 69 | table |
| 70 | .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", "Header3"]) |
| 71 | .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!![ |
| 72 | "This is a text", |
| 73 | "This is another text", |
| 74 | "This is the third text", |
| 75 | ]) |
| 76 | .add_row_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row_if().( |
| 77 | |_, _| false, |
| 78 | &vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["I won't get displayed", "Me neither", "Same here!"], |
| 79 | ) |
| 80 | .add_row_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row_if().( |
| 81 | |_, _| true, |
| 82 | &vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 83 | "This is another text", |
| 84 | "Now\nadd some\nmulti line stuff", |
| 85 | "This is awesome", |
| 86 | ], |
| 87 | ); |
| 88 | |
| 89 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 90 | let expected = " |
| 91 | +----------------------+----------------------+------------------------+ |
| 92 | | Header1 | Header2 | Header3 | |
| 93 | +======================================================================+ |
| 94 | | This is a text | This is another text | This is the third text | |
| 95 | |----------------------+----------------------+------------------------| |
| 96 | | This is another text | Now | This is awesome | |
| 97 | | | add some | | |
| 98 | | | multi line stuff | | |
| 99 | +----------------------+----------------------+------------------------+"; |
| 100 | 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().()); |
| 101 | } |
| 102 | |
| 103 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 104 | fn add_predicate_single_wrong_row_countrust-analyzer cargo comfy-table 7.2.2 all/add_predicate/add_predicate_single_wrong_row_count().() { |
| 105 | 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().(); |
| 106 | table |
| 107 | .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", "Header3"]) |
| 108 | .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!![ |
| 109 | "This is a text", |
| 110 | "This is another text", |
| 111 | "This is the third text", |
| 112 | ]) |
| 113 | .add_row_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_row_if().( |
| 114 | |_, row| row.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().2, |
| 115 | &vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 116 | "This is another text", |
| 117 | "Now\nadd some\nmulti line stuff", |
| 118 | "This is awesome", |
| 119 | ], |
| 120 | ); |
| 121 | |
| 122 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 123 | let expected = " |
| 124 | +----------------+----------------------+------------------------+ |
| 125 | | Header1 | Header2 | Header3 | |
| 126 | +================================================================+ |
| 127 | | This is a text | This is another text | This is the third text | |
| 128 | +----------------+----------------------+------------------------+"; |
| 129 | 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().()); |
| 130 | } |
| 131 | |
| 132 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 133 | fn add_predicate_multi_truerust-analyzer cargo comfy-table 7.2.2 all/add_predicate/add_predicate_multi_true().() { |
| 134 | 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().(); |
| 135 | let rows = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 136 | Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::fromrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row][`From<T>`]from().(&vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 137 | "This is a text", |
| 138 | "This is another text", |
| 139 | "This is the third text", |
| 140 | ]), |
| 141 | Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::fromrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row][`From<T>`]from().(&vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 142 | "This is another text", |
| 143 | "Now\nadd some\nmulti line stuff", |
| 144 | "This is awesome", |
| 145 | ]), |
| 146 | ]; |
| 147 | |
| 148 | table |
| 149 | .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", "Header3"]) |
| 150 | .add_rows_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_rows_if().(|_, _| true, rows); |
| 151 | |
| 152 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 153 | let expected = " |
| 154 | +----------------------+----------------------+------------------------+ |
| 155 | | Header1 | Header2 | Header3 | |
| 156 | +======================================================================+ |
| 157 | | This is a text | This is another text | This is the third text | |
| 158 | |----------------------+----------------------+------------------------| |
| 159 | | This is another text | Now | This is awesome | |
| 160 | | | add some | | |
| 161 | | | multi line stuff | | |
| 162 | +----------------------+----------------------+------------------------+"; |
| 163 | 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().()); |
| 164 | } |
| 165 | |
| 166 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 167 | fn add_predicate_multi_falserust-analyzer cargo comfy-table 7.2.2 all/add_predicate/add_predicate_multi_false().() { |
| 168 | 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().(); |
| 169 | table |
| 170 | .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", "Header3"]) |
| 171 | .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!![ |
| 172 | "This is a text", |
| 173 | "This is another text", |
| 174 | "This is the third text", |
| 175 | ]) |
| 176 | .add_rows_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_rows_if().( |
| 177 | |_, _| false, |
| 178 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::fromrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row][`From<T>`]from().(&vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 179 | "This is another text", |
| 180 | "Now\nadd some\nmulti line stuff", |
| 181 | "This is awesome", |
| 182 | ])], |
| 183 | ); |
| 184 | |
| 185 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 186 | let expected = " |
| 187 | +----------------+----------------------+------------------------+ |
| 188 | | Header1 | Header2 | Header3 | |
| 189 | +================================================================+ |
| 190 | | This is a text | This is another text | This is the third text | |
| 191 | +----------------+----------------------+------------------------+"; |
| 192 | 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().()); |
| 193 | } |
| 194 | |
| 195 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 196 | fn add_predicate_multi_mixedrust-analyzer cargo comfy-table 7.2.2 all/add_predicate/add_predicate_multi_mixed().() { |
| 197 | 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().(); |
| 198 | let rows = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 199 | Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::fromrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row][`From<T>`]from().(&vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 200 | "This is a text", |
| 201 | "This is another text", |
| 202 | "This is the third text", |
| 203 | ]), |
| 204 | Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::fromrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row][`From<T>`]from().(&vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 205 | "This is another text", |
| 206 | "Now\nadd some\nmulti line stuff", |
| 207 | "This is awesome", |
| 208 | ]), |
| 209 | ]; |
| 210 | |
| 211 | table |
| 212 | .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", "Header3"]) |
| 213 | .add_rows_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_rows_if().(|_, _| true, rows) |
| 214 | .add_rows_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_rows_if().( |
| 215 | |_, _| false, |
| 216 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::fromrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row][`From<T>`]from().(&vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 217 | "I won't get displayed", |
| 218 | "Me neither", |
| 219 | "Same here!", |
| 220 | ])], |
| 221 | ); |
| 222 | |
| 223 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 224 | let expected = " |
| 225 | +----------------------+----------------------+------------------------+ |
| 226 | | Header1 | Header2 | Header3 | |
| 227 | +======================================================================+ |
| 228 | | This is a text | This is another text | This is the third text | |
| 229 | |----------------------+----------------------+------------------------| |
| 230 | | This is another text | Now | This is awesome | |
| 231 | | | add some | | |
| 232 | | | multi line stuff | | |
| 233 | +----------------------+----------------------+------------------------+"; |
| 234 | 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().()); |
| 235 | } |
| 236 | |
| 237 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 238 | fn add_predicate_multi_wrong_rows_countrust-analyzer cargo comfy-table 7.2.2 all/add_predicate/add_predicate_multi_wrong_rows_count().() { |
| 239 | 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().(); |
| 240 | table |
| 241 | .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", "Header3"]) |
| 242 | .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!![ |
| 243 | "This is a text", |
| 244 | "This is another text", |
| 245 | "This is the third text", |
| 246 | ]) |
| 247 | .add_rows_ifrust-analyzer cargo comfy-table 7.2.2 table/impl#[Table]add_rows_if().( |
| 248 | |_, rows| rows.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().2, |
| 249 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![Rowrust-analyzer cargo comfy-table 7.2.2 row/Row#::fromrust-analyzer cargo comfy-table 7.2.2 row/impl#[Row][`From<T>`]from().(&vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 250 | "This is another text", |
| 251 | "Now\nadd some\nmulti line stuff", |
| 252 | "This is awesome", |
| 253 | ])], |
| 254 | ); |
| 255 | |
| 256 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{table}"); |
| 257 | let expected = " |
| 258 | +----------------+----------------------+------------------------+ |
| 259 | | Header1 | Header2 | Header3 | |
| 260 | +================================================================+ |
| 261 | | This is a text | This is another text | This is the third text | |
| 262 | +----------------+----------------------+------------------------+"; |
| 263 | 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().()); |
| 264 | } |