bar test update
Vladimir Bauer
9 years ago
| 12 | 12 | want []byte |
| 13 | 13 | }{ |
| 14 | 14 | { |
| 15 | termWidth: 2, | |
| 15 | termWidth: 1, | |
| 16 | 16 | barWidth: 60, |
| 17 | 17 | want: []byte{}, |
| 18 | 18 | }, |
| 19 | 19 | { |
| 20 | termWidth: 3, | |
| 20 | termWidth: 2, | |
| 21 | 21 | barWidth: 60, |
| 22 | 22 | want: []byte("[]"), |
| 23 | 23 | }, |
| 24 | 24 | { |
| 25 | 25 | termWidth: 4, |
| 26 | 26 | barWidth: 60, |
| 27 | want: []byte("[>]"), | |
| 28 | }, | |
| 29 | { | |
| 30 | termWidth: 5, | |
| 31 | barWidth: 60, | |
| 32 | 27 | want: []byte("[=>]"), |
| 33 | 28 | }, |
| 34 | 29 | { |
| 35 | 30 | termWidth: 6, |
| 36 | 31 | barWidth: 60, |
| 37 | want: []byte("[=>-]"), | |
| 32 | want: []byte("[==>-]"), | |
| 33 | }, | |
| 34 | { | |
| 35 | termWidth: 8, | |
| 36 | barWidth: 60, | |
| 37 | want: []byte("[====>-]"), | |
| 38 | }, | |
| 39 | { | |
| 40 | termWidth: 80, | |
| 41 | barWidth: 60, | |
| 42 | want: []byte("[===========================================>--------------]"), | |
| 43 | }, | |
| 44 | { | |
| 45 | termWidth: 80, | |
| 46 | barWidth: 62, | |
| 47 | want: []byte("[============================================>---------------]"), | |
| 38 | 48 | }, |
| 39 | 49 | } |
| 40 | 50 | |
| 49 | 59 | |
| 50 | 60 | func newTestState(total, current int64) *state { |
| 51 | 61 | return &state{ |
| 52 | fill: '=', | |
| 53 | empty: '-', | |
| 54 | tip: '>', | |
| 55 | leftEnd: '[', | |
| 56 | rightEnd: ']', | |
| 62 | format: formatRunes{'[', '=', '>', '-', ']'}, | |
| 57 | 63 | total: total, |
| 58 | 64 | current: current, |
| 59 | 65 | trimLeftSpace: true, |