| 1 | use craterust-analyzer cargo tabwriter 1.4.1 crate/::Alignmentrust-analyzer cargo tabwriter 1.4.1 Alignment#; |
| 2 | use craterust-analyzer cargo tabwriter 1.4.1 crate/::TabWriterrust-analyzer cargo tabwriter 1.4.1 TabWriter#; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#; |
| 4 | |
| 5 | fn ordierust-analyzer cargo tabwriter 1.4.1 test/ordie().<T, E: ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#>(r: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>) -> T { |
| 6 | match r { |
| 7 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(r) => r, |
| 8 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("{}", e.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#to_string().()), |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | fn readable_strrust-analyzer cargo tabwriter 1.4.1 test/readable_str().(s: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 13 | s.replacerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replace().(" ", "·").replacerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replace().("\t", "<TAB>") |
| 14 | } |
| 15 | |
| 16 | fn tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().() -> TabWriterrust-analyzer cargo tabwriter 1.4.1 TabWriter#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> { |
| 17 | TabWriterrust-analyzer cargo tabwriter 1.4.1 TabWriter#::newrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]new().(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().()) |
| 18 | } |
| 19 | |
| 20 | fn tabifyrust-analyzer cargo tabwriter 1.4.1 test/tabify().(mut tw: TabWriterrust-analyzer cargo tabwriter 1.4.1 TabWriter#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>>, s: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 21 | ordierust-analyzer cargo tabwriter 1.4.1 test/ordie().(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(&mut tw, "{}", s)); |
| 22 | ordierust-analyzer cargo tabwriter 1.4.1 test/ordie().(tw.flushrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`][Write]flush().()); |
| 23 | ordierust-analyzer cargo tabwriter 1.4.1 test/ordie().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8().(tw.into_innerrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]into_inner().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().())) |
| 24 | } |
| 25 | |
| 26 | fn iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tw: TabWriterrust-analyzer cargo tabwriter 1.4.1 TabWriter#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>>, s: &str, expected: &str) { |
| 27 | let written = tabifyrust-analyzer cargo tabwriter 1.4.1 test/tabify().(tw, s); |
| 28 | if expected rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[`&str`][`PartialEq<String>`]ne().!=rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[`&str`][`PartialEq<String>`]ne(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[`&str`][`PartialEq<String>`]ne().written { |
| 29 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!( |
| 30 | "\n\nexpected:\n-----\n{}\n-----\ngot:\n-----\n{}\n-----\n\n", |
| 31 | readable_strrust-analyzer cargo tabwriter 1.4.1 test/readable_str().(expected), |
| 32 | readable_strrust-analyzer cargo tabwriter 1.4.1 test/readable_str().(&written) |
| 33 | ); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 38 | fn test_no_cellsrust-analyzer cargo tabwriter 1.4.1 test/test_no_cells().() { |
| 39 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().(), "foo\nbar\nfubar", "foo\nbar\nfubar"); |
| 40 | } |
| 41 | |
| 42 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 43 | fn test_no_cells_trailingrust-analyzer cargo tabwriter 1.4.1 test/test_no_cells_trailing().() { |
| 44 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().(), "foo\nbar\nfubar\n", "foo\nbar\nfubar\n"); |
| 45 | } |
| 46 | |
| 47 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 48 | fn test_no_cells_priorrust-analyzer cargo tabwriter 1.4.1 test/test_no_cells_prior().() { |
| 49 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().(), "\nfoo\nbar\nfubar", "\nfoo\nbar\nfubar"); |
| 50 | } |
| 51 | |
| 52 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 53 | fn test_emptyrust-analyzer cargo tabwriter 1.4.1 test/test_empty().() { |
| 54 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().(), "", ""); |
| 55 | } |
| 56 | |
| 57 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 58 | fn test_empty_linesrust-analyzer cargo tabwriter 1.4.1 test/test_empty_lines().() { |
| 59 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().(), "\n\n\n\n", "\n\n\n\n"); |
| 60 | } |
| 61 | |
| 62 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 63 | fn test_empty_cellrust-analyzer cargo tabwriter 1.4.1 test/test_empty_cell().() { |
| 64 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(2), "\t\n", " \n"); |
| 65 | } |
| 66 | |
| 67 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 68 | fn test_empty_cell_no_minrust-analyzer cargo tabwriter 1.4.1 test/test_empty_cell_no_min().() { |
| 69 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(0), "\t\n", "\n"); |
| 70 | } |
| 71 | |
| 72 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 73 | fn test_empty_cellsrust-analyzer cargo tabwriter 1.4.1 test/test_empty_cells().() { |
| 74 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(2), "\t\t\n", " \n"); |
| 75 | } |
| 76 | |
| 77 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 78 | fn test_empty_cells_no_minrust-analyzer cargo tabwriter 1.4.1 test/test_empty_cells_no_min().() { |
| 79 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(0), "\t\t\n", "\n"); |
| 80 | } |
| 81 | |
| 82 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 83 | fn test_empty_cells_ignore_trailingrust-analyzer cargo tabwriter 1.4.1 test/test_empty_cells_ignore_trailing().() { |
| 84 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(2), "\t\t\t", " "); |
| 85 | } |
| 86 | |
| 87 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 88 | fn test_one_cellrust-analyzer cargo tabwriter 1.4.1 test/test_one_cell().() { |
| 89 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(2).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(2), "a\tb\nxx\tyy", "a b\nxx yy"); |
| 90 | } |
| 91 | |
| 92 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 93 | fn test_one_cell_rightrust-analyzer cargo tabwriter 1.4.1 test/test_one_cell_right().() { |
| 94 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 95 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(2).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(2).alignmentrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]alignment().(Alignmentrust-analyzer cargo tabwriter 1.4.1 Alignment#::Rightrust-analyzer cargo tabwriter 1.4.1 Alignment#Right#), |
| 96 | "a\tb\nxx\tyy", |
| 97 | " a b\nxx yy", |
| 98 | ); |
| 99 | } |
| 100 | |
| 101 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 102 | fn test_one_cell_centerrust-analyzer cargo tabwriter 1.4.1 test/test_one_cell_center().() { |
| 103 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 104 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(2).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(2).alignmentrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]alignment().(Alignmentrust-analyzer cargo tabwriter 1.4.1 Alignment#::Centerrust-analyzer cargo tabwriter 1.4.1 Alignment#Center#), |
| 105 | "a\tb\nxx\tyy", |
| 106 | "a b\nxx yy", |
| 107 | ); |
| 108 | } |
| 109 | |
| 110 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 111 | fn test_no_paddingrust-analyzer cargo tabwriter 1.4.1 test/test_no_padding().() { |
| 112 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(2), "a\tb\nxx\tyy", "a b\nxxyy"); |
| 113 | } |
| 114 | |
| 115 | // See: https://github.com/BurntSushi/tabwriter/issues/26 |
| 116 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 117 | fn test_no_padding_one_rowrust-analyzer cargo tabwriter 1.4.1 test/test_no_padding_one_row().() { |
| 118 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(2), "a\tb\n", "a b\n"); |
| 119 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(1), "a\tb\n", "ab\n"); |
| 120 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(0), "a\tb\n", "ab\n"); |
| 121 | } |
| 122 | |
| 123 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 124 | fn test_minwidthrust-analyzer cargo tabwriter 1.4.1 test/test_minwidth().() { |
| 125 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().(tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(5).paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(0), "a\tb\nxx\tyy", "a b\nxx yy"); |
| 126 | } |
| 127 | |
| 128 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 129 | fn test_contiguous_columnsrust-analyzer cargo tabwriter 1.4.1 test/test_contiguous_columns().() { |
| 130 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 131 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(1).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(0), |
| 132 | "x\tfoo\tx\nx\tfoofoo\tx\n\nx\tfoofoofoo\tx", |
| 133 | "x foo x\nx foofoo x\n\nx foofoofoo x", |
| 134 | ); |
| 135 | } |
| 136 | |
| 137 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 138 | fn test_table_rightrust-analyzer cargo tabwriter 1.4.1 test/test_table_right().() { |
| 139 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 140 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(1).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(0).alignmentrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]alignment().(Alignmentrust-analyzer cargo tabwriter 1.4.1 Alignment#::Rightrust-analyzer cargo tabwriter 1.4.1 Alignment#Right#), |
| 141 | "x\tfoo\txx\t\nxx\tfoofoo\tx\t\n", |
| 142 | " x foo xx \nxx foofoo x \n", |
| 143 | ); |
| 144 | } |
| 145 | |
| 146 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 147 | fn test_table_centerrust-analyzer cargo tabwriter 1.4.1 test/test_table_center().() { |
| 148 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 149 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(1).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(0).alignmentrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]alignment().(Alignmentrust-analyzer cargo tabwriter 1.4.1 Alignment#::Centerrust-analyzer cargo tabwriter 1.4.1 Alignment#Center#), |
| 150 | "x\tfoo\txx\t\nxx\tfoofoo\tx\t\n", |
| 151 | "x foo xx \nxx foofoo x \n", |
| 152 | ); |
| 153 | } |
| 154 | |
| 155 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 156 | fn test_contiguous_columns_rightrust-analyzer cargo tabwriter 1.4.1 test/test_contiguous_columns_right().() { |
| 157 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 158 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(1).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(0).alignmentrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]alignment().(Alignmentrust-analyzer cargo tabwriter 1.4.1 Alignment#::Rightrust-analyzer cargo tabwriter 1.4.1 Alignment#Right#), |
| 159 | "x\tfoo\tx\nx\tfoofoo\tx\n\nx\tfoofoofoo\tx", |
| 160 | "x foo x\nx foofoo x\n\nx foofoofoo x", |
| 161 | ); |
| 162 | } |
| 163 | |
| 164 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 165 | fn test_contiguous_columns_centerrust-analyzer cargo tabwriter 1.4.1 test/test_contiguous_columns_center().() { |
| 166 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 167 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(1).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(0).alignmentrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]alignment().(Alignmentrust-analyzer cargo tabwriter 1.4.1 Alignment#::Centerrust-analyzer cargo tabwriter 1.4.1 Alignment#Center#), |
| 168 | "x\tfoo\tx\nx\tfoofoo\tx\n\nx\tfoofoofoo\tx", |
| 169 | "x foo x\nx foofoo x\n\nx foofoofoo x", |
| 170 | ); |
| 171 | } |
| 172 | |
| 173 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 174 | fn test_unicoderust-analyzer cargo tabwriter 1.4.1 test/test_unicode().() { |
| 175 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 176 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(2).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(2), |
| 177 | "a\tÞykkvibær\tz\naaaa\tïn Bou Chella\tzzzz\na\tBâb el Ahmar\tz", |
| 178 | "a Þykkvibær z\n\ |
| 179 | aaaa ïn Bou Chella zzzz\n\ |
| 180 | a Bâb el Ahmar z", |
| 181 | ) |
| 182 | } |
| 183 | |
| 184 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 185 | fn test_contiguous_columns_complexrust-analyzer cargo tabwriter 1.4.1 test/test_contiguous_columns_complex().() { |
| 186 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 187 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(1).minwidthrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]minwidth().(3), |
| 188 | " |
| 189 | fn foobar() { |
| 190 | let mut x = 1+1; // addition |
| 191 | x += 1; // increment in place |
| 192 | let y = x * x * x * x; // multiply! |
| 193 | |
| 194 | y += 1; // this is another group |
| 195 | y += 2 * 2; // that is separately aligned |
| 196 | } |
| 197 | ", |
| 198 | " |
| 199 | fn foobar() { |
| 200 | let mut x = 1+1; // addition |
| 201 | x += 1; // increment in place |
| 202 | let y = x * x * x * x; // multiply! |
| 203 | |
| 204 | y += 1; // this is another group |
| 205 | y += 2 * 2; // that is separately aligned |
| 206 | } |
| 207 | ", |
| 208 | ); |
| 209 | } |
| 210 | |
| 211 | // This tests that ANSI formatting is handled automatically when the ansi_formatting |
| 212 | // feature is enabled without any other configuration. |
| 213 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 214 | #[cfg(feature = "ansi_formatting")] |
| 215 | fn ansi_formatting_by_featurerust-analyzer cargo tabwriter 1.4.1 test/ansi_formatting_by_feature().() { |
| 216 | let output = "foo\tbar\tfoobar\n\ |
| 217 | \x1b[31mföÅ\x1b[0m\t\x1b[32mbär\x1b[0m\t\x1b[36mfoobar\x1b[0m\n\ |
| 218 | \x1b[34mfoo\tbar\tfoobar\n\x1b[0m"; |
| 219 | |
| 220 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 221 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().(), |
| 222 | &output[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 223 | "foo bar foobar\n\ |
| 224 | \x1b[31mföÅ\x1b[0m \x1b[32mbär\x1b[0m \x1b[36mfoobar\x1b[0m\n\ |
| 225 | \x1b[34mfoo bar foobar\n\x1b[0m", |
| 226 | ) |
| 227 | } |
| 228 | |
| 229 | // This tests that ANSI formatting is handled when explicitly opted into, |
| 230 | // regardless of whether the ansi_formatting feature is enabled. |
| 231 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 232 | fn ansi_formatting_by_configrust-analyzer cargo tabwriter 1.4.1 test/ansi_formatting_by_config().() { |
| 233 | let output = "foo\tbar\tfoobar\n\ |
| 234 | \x1b[31mföÅ\x1b[0m\t\x1b[32mbär\x1b[0m\t\x1b[36mfoobar\x1b[0m\n\ |
| 235 | \x1b[34mfoo\tbar\tfoobar\n\x1b[0m"; |
| 236 | |
| 237 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 238 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().ansirust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]ansi().(true), |
| 239 | &output[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 240 | "foo bar foobar\n\ |
| 241 | \x1b[31mföÅ\x1b[0m \x1b[32mbär\x1b[0m \x1b[36mfoobar\x1b[0m\n\ |
| 242 | \x1b[34mfoo bar foobar\n\x1b[0m", |
| 243 | ) |
| 244 | } |
| 245 | |
| 246 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 247 | fn tab_indentrust-analyzer cargo tabwriter 1.4.1 test/tab_indent().() { |
| 248 | iseqrust-analyzer cargo tabwriter 1.4.1 test/iseq().( |
| 249 | tabwrust-analyzer cargo tabwriter 1.4.1 test/tabw().().tab_indentrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]tab_indent().(true).paddingrust-analyzer cargo tabwriter 1.4.1 impl#[`TabWriter<W>`]padding().(1), |
| 250 | " |
| 251 | type cell struct { |
| 252 | \tsize\tint\t// cell size in bytes |
| 253 | \twidth\tint\t// cell width in runes |
| 254 | \thtab\tbool\t// true if the cell is terminated by an htab ('\\t') |
| 255 | } |
| 256 | ", |
| 257 | " |
| 258 | type cell struct { |
| 259 | \tsize int // cell size in bytes |
| 260 | \twidth int // cell width in runes |
| 261 | \thtab bool // true if the cell is terminated by an htab ('\\t') |
| 262 | } |
| 263 | ", |
| 264 | ) |
| 265 | } |