Codebase list golang-github-vbauerster-mpb / 275c8e1
fix import paths Vladimir Bauer 7 years ago
16 changed file(s) with 31 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
66 "sync"
77 "time"
88
9 "github.com/vbauerster/mpb"
10 "github.com/vbauerster/mpb/decor"
9 "github.com/vbauerster/mpb/v4"
10 "github.com/vbauerster/mpb/v4/decor"
1111 )
1212
1313 func init() {
1010 "time"
1111 "unicode/utf8"
1212
13 "github.com/vbauerster/mpb/decor"
13 "github.com/vbauerster/mpb/v4/decor"
1414 )
1515
1616 // Bar represents a progress Bar
33 "io"
44 "strings"
55
6 "github.com/vbauerster/mpb/decor"
7 "github.com/vbauerster/mpb/internal"
6 "github.com/vbauerster/mpb/v4/decor"
7 "github.com/vbauerster/mpb/v4/internal"
88 )
99
1010 const (
33 "io"
44 "unicode/utf8"
55
6 "github.com/vbauerster/mpb/decor"
6 "github.com/vbauerster/mpb/v4/decor"
77 )
88
99 // BarOption is a function option which changes the default behavior of a bar.
88 "time"
99 "unicode/utf8"
1010
11 . "github.com/vbauerster/mpb"
12 "github.com/vbauerster/mpb/decor"
11 "github.com/vbauerster/mpb/v4"
12 "github.com/vbauerster/mpb/v4/decor"
1313 )
1414
1515 func TestBarCompleted(t *testing.T) {
16 p := New(WithOutput(ioutil.Discard))
16 p := mpb.New(mpb.WithOutput(ioutil.Discard))
1717 total := 80
1818 bar := p.AddBar(int64(total))
1919
3131 }
3232
3333 func TestBarID(t *testing.T) {
34 p := New(WithOutput(ioutil.Discard))
34 p := mpb.New(mpb.WithOutput(ioutil.Discard))
3535 total := 80
3636 wantID := 11
37 bar := p.AddBar(int64(total), BarID(wantID))
37 bar := p.AddBar(int64(total), mpb.BarID(wantID))
3838
3939 go func() {
4040 for i := 0; i < total; i++ {
5656 var buf bytes.Buffer
5757
5858 width := 100
59 p := New(WithOutput(&buf), WithWidth(width))
59 p := mpb.New(mpb.WithOutput(&buf), mpb.WithWidth(width))
6060
6161 total := 100
6262 till := 30
6363 refillRune := '+'
6464
65 bar := p.AddBar(int64(total), TrimSpace())
65 bar := p.AddBar(int64(total), mpb.TrimSpace())
6666
6767 bar.SetRefill(till, refillRune)
6868 bar.IncrBy(till)
8989 func TestBarStyle(t *testing.T) {
9090 var buf bytes.Buffer
9191 customFormat := "╢▌▌░╟"
92 p := New(WithOutput(&buf))
92 p := mpb.New(mpb.WithOutput(&buf))
9393 total := 80
94 bar := p.AddBar(int64(total), BarStyle(customFormat), TrimSpace())
94 bar := p.AddBar(int64(total), mpb.BarStyle(customFormat), mpb.TrimSpace())
9595
9696 for i := 0; i < total; i++ {
9797 bar.Increment()
115115
116116 func TestBarPanics(t *testing.T) {
117117 var buf bytes.Buffer
118 p := New(WithDebugOutput(&buf), WithOutput(ioutil.Discard))
118 p := mpb.New(mpb.WithDebugOutput(&buf), mpb.WithOutput(ioutil.Discard))
119119
120120 wantPanic := "Upps!!!"
121121 total := 100
122122
123 bar := p.AddBar(int64(total), PrependDecorators(panicDecorator(wantPanic)))
123 bar := p.AddBar(int64(total), mpb.PrependDecorators(panicDecorator(wantPanic)))
124124
125125 go func() {
126126 for i := 0; i < 100; i++ {
33 "io/ioutil"
44 "testing"
55
6 "github.com/vbauerster/mpb/decor"
6 "github.com/vbauerster/mpb/v4/decor"
77 )
88
99 func BenchmarkIncrSingleBar(b *testing.B) {
55 "bytes"
66 "testing"
77
8 . "github.com/vbauerster/mpb/cwriter"
8 . "github.com/vbauerster/mpb/v4/cwriter"
99 )
1010
1111 // TestWriterPosix by writing and flushing many times. The output buffer
22 import (
33 "fmt"
44
5 "github.com/vbauerster/mpb/internal"
5 "github.com/vbauerster/mpb/v4/internal"
66 )
77
88 // Percentage returns percentage decorator.
33 "sync"
44 "testing"
55
6 . "github.com/vbauerster/mpb"
7 "github.com/vbauerster/mpb/decor"
6 . "github.com/vbauerster/mpb/v4"
7 "github.com/vbauerster/mpb/v4/decor"
88 )
99
1010 func TestNameDecorator(t *testing.T) {
22 require (
33 github.com/VividCortex/ewma v1.1.1
44 github.com/mattn/go-isatty v0.0.4
5 github.com/vbauerster/mpb v3.3.4+incompatible
65 golang.org/x/crypto v0.0.0-20190129170551-bf88e3f4ba72
76 golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc // indirect
87 )
11 github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
22 github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
33 github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
4 github.com/vbauerster/mpb v3.3.4+incompatible h1:DDIhnwmgTQIDZo+SWlEr5d6mJBxkOLBwCXPzunhEfJ4=
5 github.com/vbauerster/mpb v3.3.4+incompatible/go.mod h1:zAHG26FUhVKETRu+MWqYXcI70POlC6N8up9p1dID7SU=
64 golang.org/x/crypto v0.0.0-20190129170551-bf88e3f4ba72 h1:hOSpsWG5LMauyHIJqtLUU+44acN/ft/9cpzc1ynVDyg=
75 golang.org/x/crypto v0.0.0-20190129170551-bf88e3f4ba72/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
86 golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc h1:WiYx1rIFmx8c0mXAFtv5D/mHyKe1+jmuP7PViuwqwuQ=
55 "sync"
66 "time"
77
8 "github.com/vbauerster/mpb/cwriter"
8 "github.com/vbauerster/mpb/v4/cwriter"
99 )
1010
1111 // ProgressOption is a function option which changes the default
99 "sync"
1010 "time"
1111
12 "github.com/vbauerster/mpb/cwriter"
12 "github.com/vbauerster/mpb/v4/cwriter"
1313 )
1414
1515 const (
99 "testing"
1010 "time"
1111
12 "github.com/vbauerster/mpb"
13 . "github.com/vbauerster/mpb"
14 "github.com/vbauerster/mpb/cwriter"
12 "github.com/vbauerster/mpb/v4"
13 "github.com/vbauerster/mpb/v4/cwriter"
1514 )
1615
1716 var (
2524 }
2625
2726 func TestBarCount(t *testing.T) {
28 p := New(WithOutput(ioutil.Discard))
27 p := mpb.New(mpb.WithOutput(ioutil.Discard))
2928
3029 var wg sync.WaitGroup
3130 wg.Add(1)
5150 }
5251
5352 func TestBarAbort(t *testing.T) {
54 p := New(WithOutput(ioutil.Discard))
53 p := mpb.New(mpb.WithOutput(ioutil.Discard))
5554
5655 var wg sync.WaitGroup
5756 wg.Add(1)
58 bars := make([]*Bar, 3)
57 bars := make([]*mpb.Bar, 3)
5958 for i := 0; i < 3; i++ {
6059 b := p.AddBar(100)
6160 bars[i] = b
55 "strings"
66 "testing"
77
8 "github.com/vbauerster/mpb"
8 "github.com/vbauerster/mpb/v4"
99 )
1010
1111 const content = `Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
44 "strings"
55 "unicode/utf8"
66
7 "github.com/vbauerster/mpb/decor"
7 "github.com/vbauerster/mpb/v4/decor"
88 )
99
1010 // SpinnerAlignment enum.