Skip to content

Commit 0ae81bf

Browse files
committed
update some for tests
1 parent 4fd11c1 commit 0ae81bf

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

color_test.go

+14-13
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,12 @@ func Example() {
6363
func TestSet(t *testing.T) {
6464
is := assert.New(t)
6565

66-
// set enable
67-
Enable = true
6866
fmt.Println("support color:", SupportColor())
6967
fmt.Println("test color.Set() on OS:", runtime.GOOS)
70-
if os.Getenv("GITHUB_ACTION") != "" {
71-
fmt.Println("Skip run the tests on Github Action")
72-
return
73-
}
74-
75-
num, err := Set(FgGreen)
76-
is.True(num > 0)
77-
is.NoError(err)
78-
_, err = Reset()
79-
is.NoError(err)
8068

8169
// disable
8270
old := Disable()
83-
num, err = Set(FgGreen)
71+
num, err := Set(FgGreen)
8472
is.Nil(err)
8573
is.Equal(0, num)
8674

@@ -89,6 +77,19 @@ func TestSet(t *testing.T) {
8977
is.Equal(0, num)
9078
Enable = old // revert
9179

80+
// set enable
81+
Enable = true
82+
if os.Getenv("GITHUB_ACTION") != "" {
83+
fmt.Println("Skip run the tests on Github Action")
84+
return
85+
}
86+
87+
num, err = Set(FgGreen)
88+
is.True(num > 0)
89+
is.NoError(err)
90+
_, err = Reset()
91+
is.NoError(err)
92+
9293
if runtime.GOOS == "windows" {
9394
fd := uintptr(syscall.Stdout)
9495
// if run test by goland, will return false

0 commit comments

Comments
 (0)