Codebase list golang-github-vbauerster-mpb / 66a2fa4
refactoring Vladimir Bauer 6 years ago
1 changed file(s) with 118 addition(s) and 118 deletion(s). Raw diff Collapse all Expand all
1212 style string
1313 total, current int64
1414 barWidth int
15 trimSpace bool
15 trim bool
1616 reverse bool
1717 refill int64
1818 want string
2525 want: "… ",
2626 },
2727 {
28 name: "t,c{60,20}trim",
29 total: 60,
30 current: 20,
31 trimSpace: true,
32 want: "",
28 name: "t,c{60,20}trim",
29 total: 60,
30 current: 20,
31 trim: true,
32 want: "",
3333 },
3434 },
3535 1: {
4040 want: "… ",
4141 },
4242 {
43 name: "t,c{60,20}trim",
44 total: 60,
45 current: 20,
46 trimSpace: true,
47 want: "",
43 name: "t,c{60,20}trim",
44 total: 60,
45 current: 20,
46 trim: true,
47 want: "",
4848 },
4949 },
5050 2: {
5555 want: " ",
5656 },
5757 {
58 name: "t,c{60,20}trim",
59 total: 60,
60 current: 20,
61 trimSpace: true,
62 want: "[]",
58 name: "t,c{60,20}trim",
59 total: 60,
60 current: 20,
61 trim: true,
62 want: "[]",
6363 },
6464 },
6565 3: {
7070 want: " ",
7171 },
7272 {
73 name: "t,c{60,20}trim",
74 total: 60,
75 current: 20,
76 trimSpace: true,
77 want: "[-]",
73 name: "t,c{60,20}trim",
74 total: 60,
75 current: 20,
76 trim: true,
77 want: "[-]",
7878 },
7979 },
8080 4: {
8585 want: " [] ",
8686 },
8787 {
88 name: "t,c{60,20}trim",
89 total: 60,
90 current: 20,
91 trimSpace: true,
92 want: "[>-]",
88 name: "t,c{60,20}trim",
89 total: 60,
90 current: 20,
91 trim: true,
92 want: "[>-]",
9393 },
9494 },
9595 5: {
100100 want: " [-] ",
101101 },
102102 {
103 name: "t,c{60,20}trim",
104 total: 60,
105 current: 20,
106 trimSpace: true,
107 want: "[>--]",
103 name: "t,c{60,20}trim",
104 total: 60,
105 current: 20,
106 trim: true,
107 want: "[>--]",
108108 },
109109 },
110110 6: {
115115 want: " [>-] ",
116116 },
117117 {
118 name: "t,c{60,20}trim",
119 total: 60,
120 current: 20,
121 trimSpace: true,
122 want: "[>---]",
118 name: "t,c{60,20}trim",
119 total: 60,
120 current: 20,
121 trim: true,
122 want: "[>---]",
123123 },
124124 },
125125 7: {
130130 want: " [>--] ",
131131 },
132132 {
133 name: "t,c{60,20}trim",
134 total: 60,
135 current: 20,
136 trimSpace: true,
137 want: "[=>---]",
133 name: "t,c{60,20}trim",
134 total: 60,
135 current: 20,
136 trim: true,
137 want: "[=>---]",
138138 },
139139 },
140140 8: {
145145 want: " [>---] ",
146146 },
147147 {
148 name: "t,c{60,20}trim",
149 total: 60,
150 current: 20,
151 trimSpace: true,
152 want: "[=>----]",
148 name: "t,c{60,20}trim",
149 total: 60,
150 current: 20,
151 trim: true,
152 want: "[=>----]",
153153 },
154154 },
155155 80: {
160160 want: " [========================>---------------------------------------------------] ",
161161 },
162162 {
163 name: "t,c{60,20}trim",
164 total: 60,
165 current: 20,
166 trimSpace: true,
167 want: "[=========================>----------------------------------------------------]",
163 name: "t,c{60,20}trim",
164 total: 60,
165 current: 20,
166 trim: true,
167 want: "[=========================>----------------------------------------------------]",
168168 },
169169 {
170170 name: "t,c,bw{60,20,60}",
174174 want: " [==================>---------------------------------------] ",
175175 },
176176 {
177 name: "t,c,bw{60,20,60}trim",
178 total: 60,
179 current: 20,
180 barWidth: 60,
181 trimSpace: true,
182 want: "[==================>---------------------------------------]",
177 name: "t,c,bw{60,20,60}trim",
178 total: 60,
179 current: 20,
180 barWidth: 60,
181 trim: true,
182 want: "[==================>---------------------------------------]",
183183 },
184184 },
185185 100: {
190190 want: " [------------------------------------------------------------------------------------------------] ",
191191 },
192192 {
193 name: "t,c{100,0}trim",
194 total: 100,
195 current: 0,
196 trimSpace: true,
197 want: "[--------------------------------------------------------------------------------------------------]",
193 name: "t,c{100,0}trim",
194 total: 100,
195 current: 0,
196 trim: true,
197 want: "[--------------------------------------------------------------------------------------------------]",
198198 },
199199 {
200200 name: "t,c{100,1}",
203203 want: " [>-----------------------------------------------------------------------------------------------] ",
204204 },
205205 {
206 name: "t,c{100,1}trim",
207 total: 100,
208 current: 1,
209 trimSpace: true,
210 want: "[>-------------------------------------------------------------------------------------------------]",
206 name: "t,c{100,1}trim",
207 total: 100,
208 current: 1,
209 trim: true,
210 want: "[>-------------------------------------------------------------------------------------------------]",
211211 },
212212 {
213213 name: "t,c{100,33}",
216216 want: " [===============================>----------------------------------------------------------------] ",
217217 },
218218 {
219 name: "t,c{100,33}trim",
220 total: 100,
221 current: 33,
222 trimSpace: true,
223 want: "[===============================>------------------------------------------------------------------]",
224 },
225 {
226 name: "t,c{100,33}trim,rev",
227 total: 100,
228 current: 33,
229 trimSpace: true,
230 reverse: true,
231 want: "[------------------------------------------------------------------<===============================]",
232 },
233 {
234 name: "t,c,refill{100,33,33}",
219 name: "t,c{100,33}trim",
220 total: 100,
221 current: 33,
222 trim: true,
223 want: "[===============================>------------------------------------------------------------------]",
224 },
225 {
226 name: "t,c{100,33}trim,rev",
227 total: 100,
228 current: 33,
229 trim: true,
230 reverse: true,
231 want: "[------------------------------------------------------------------<===============================]",
232 },
233 {
234 name: "t,c,r{100,33,33}",
235235 total: 100,
236236 current: 33,
237237 refill: 33,
238238 want: " [+++++++++++++++++++++++++++++++>----------------------------------------------------------------] ",
239239 },
240240 {
241 name: "t,c,refill{100,33,33}trim",
242 total: 100,
243 current: 33,
244 refill: 33,
245 trimSpace: true,
246 want: "[+++++++++++++++++++++++++++++++>------------------------------------------------------------------]",
247 },
248 {
249 name: "t,c,refill{100,33,33}trim,rev",
250 total: 100,
251 current: 33,
252 refill: 33,
253 trimSpace: true,
254 reverse: true,
255 want: "[------------------------------------------------------------------<+++++++++++++++++++++++++++++++]",
256 },
257 {
258 name: "t,c,refill{100,40,33}",
241 name: "t,c,r{100,33,33}trim",
242 total: 100,
243 current: 33,
244 refill: 33,
245 trim: true,
246 want: "[+++++++++++++++++++++++++++++++>------------------------------------------------------------------]",
247 },
248 {
249 name: "t,c,r{100,33,33}trim,rev",
250 total: 100,
251 current: 33,
252 refill: 33,
253 trim: true,
254 reverse: true,
255 want: "[------------------------------------------------------------------<+++++++++++++++++++++++++++++++]",
256 },
257 {
258 name: "t,c,r{100,40,33}",
259259 total: 100,
260260 current: 40,
261261 refill: 33,
262262 want: " [++++++++++++++++++++++++++++++++=====>----------------------------------------------------------] ",
263263 },
264264 {
265 name: "t,c,refill{100,40,33}trim",
266 total: 100,
267 current: 40,
268 refill: 33,
269 trimSpace: true,
270 want: "[++++++++++++++++++++++++++++++++======>-----------------------------------------------------------]",
265 name: "t,c,r{100,40,33}trim",
266 total: 100,
267 current: 40,
268 refill: 33,
269 trim: true,
270 want: "[++++++++++++++++++++++++++++++++======>-----------------------------------------------------------]",
271271 },
272272 {
273273 name: "t,c{100,99}",
276276 want: " [==============================================================================================>-] ",
277277 },
278278 {
279 name: "t,c{100,99}trim",
280 total: 100,
281 current: 99,
282 trimSpace: true,
283 want: "[================================================================================================>-]",
279 name: "t,c{100,99}trim",
280 total: 100,
281 current: 99,
282 trim: true,
283 want: "[================================================================================================>-]",
284284 },
285285 {
286286 name: "t,c{100,100}",
289289 want: " [================================================================================================] ",
290290 },
291291 {
292 name: "t,c{100,100}trim",
293 total: 100,
294 current: 100,
295 trimSpace: true,
296 want: "[==================================================================================================]",
292 name: "t,c{100,100}trim",
293 total: 100,
294 current: 100,
295 trim: true,
296 want: "[==================================================================================================]",
297297 },
298298 {
299299 name: "[=の-] t,c{100,1}",
312312 s.reqWidth = tc.barWidth
313313 s.total = tc.total
314314 s.current = tc.current
315 s.trimSpace = tc.trimSpace
315 s.trimSpace = tc.trim
316316 if tc.refill > 0 {
317317 if f, ok := s.filler.(interface{ SetRefill(int64) }); ok {
318318 f.SetRefill(tc.refill)