Codebase list golang-github-vbauerster-mpb / a637559
refactoring TestDecorStatisticsAvailableWidth involve decor.Meta and check that widht is correct Vladimir Bauer 2 years ago
1 changed file(s) with 7 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
228228 ch := make(chan int, 2)
229229 td1 := func(s decor.Statistics) string {
230230 ch <- s.AvailableWidth
231 return fmt.Sprintf("\x1b[31;1;4m%s\x1b[0m", strings.Repeat("0", 20))
231 return strings.Repeat("0", 20)
232232 }
233233 td2 := func(s decor.Statistics) string {
234234 ch <- s.AvailableWidth
245245 mpb.BarFillerTrim(),
246246 mpb.PrependDecorators(
247247 decor.Name(strings.Repeat("0", 20)),
248 decor.Any(td1),
248 decor.Meta(
249 decor.Any(td1),
250 func(s string) string {
251 return fmt.Sprint("\x1b[31;1m", s, "\x1b[0m")
252 },
253 ),
249254 ),
250255 mpb.AppendDecorators(
251256 decor.Name(strings.Repeat("0", 20)),