refactoring TestDecorStatisticsAvailableWidth
involve decor.Meta and check that widht is correct
Vladimir Bauer
2 years ago
| 228 | 228 | ch := make(chan int, 2) |
| 229 | 229 | td1 := func(s decor.Statistics) string { |
| 230 | 230 | ch <- s.AvailableWidth |
| 231 | return fmt.Sprintf("\x1b[31;1;4m%s\x1b[0m", strings.Repeat("0", 20)) | |
| 231 | return strings.Repeat("0", 20) | |
| 232 | 232 | } |
| 233 | 233 | td2 := func(s decor.Statistics) string { |
| 234 | 234 | ch <- s.AvailableWidth |
| 245 | 245 | mpb.BarFillerTrim(), |
| 246 | 246 | mpb.PrependDecorators( |
| 247 | 247 | 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 | ), | |
| 249 | 254 | ), |
| 250 | 255 | mpb.AppendDecorators( |
| 251 | 256 | decor.Name(strings.Repeat("0", 20)), |