-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathspin_test.go
49 lines (44 loc) · 973 Bytes
/
spin_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package spin_test
import (
"testing"
"time"
"github.com/caarlos0/spin"
)
var spins = map[string]string{
"Box1": spin.Box1,
"Box2": spin.Box2,
"Box3": spin.Box3,
"Box4": spin.Box4,
"Box5": spin.Box5,
"Box6": spin.Box6,
"Box7": spin.Box7,
"Spin1": spin.Spin1,
"Spin2": spin.Spin2,
"Spin3": spin.Spin3,
"Spin4": spin.Spin4,
"Spin5": spin.Spin5,
"Spin6": spin.Spin6,
"Spin7": spin.Spin7,
"Spin8": spin.Spin8,
"Spin9": spin.Spin9,
"Spin10": spin.Spin10,
"Spin11": spin.Spin11,
"Spin12": spin.Spin12,
"Spin13": spin.Spin13,
"Spin14": spin.Spin14,
"Spin15": spin.Spin15,
"Default": spin.Default,
}
func TestSpin(t *testing.T) {
for name, spinner := range spins {
t.Run(name, func(t *testing.T) {
show(name, spinner)
})
}
}
func show(name, frames string) {
s := spin.New(" \033[36m["+name+"] Testing\033[m %s", spin.WithFrames(frames))
s.Start()
defer s.Stop()
time.Sleep(2 * time.Second)
}