From 0ae81bf4312507f3c9a4136faddef52424215e4d Mon Sep 17 00:00:00 2001 From: inhere Date: Tue, 2 Feb 2021 19:21:57 +0800 Subject: [PATCH] update some for tests --- color_test.go | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/color_test.go b/color_test.go index c719420..b5fa65c 100644 --- a/color_test.go +++ b/color_test.go @@ -63,24 +63,12 @@ func Example() { func TestSet(t *testing.T) { is := assert.New(t) - // set enable - Enable = true fmt.Println("support color:", SupportColor()) fmt.Println("test color.Set() on OS:", runtime.GOOS) - if os.Getenv("GITHUB_ACTION") != "" { - fmt.Println("Skip run the tests on Github Action") - return - } - - num, err := Set(FgGreen) - is.True(num > 0) - is.NoError(err) - _, err = Reset() - is.NoError(err) // disable old := Disable() - num, err = Set(FgGreen) + num, err := Set(FgGreen) is.Nil(err) is.Equal(0, num) @@ -89,6 +77,19 @@ func TestSet(t *testing.T) { is.Equal(0, num) Enable = old // revert + // set enable + Enable = true + if os.Getenv("GITHUB_ACTION") != "" { + fmt.Println("Skip run the tests on Github Action") + return + } + + num, err = Set(FgGreen) + is.True(num > 0) + is.NoError(err) + _, err = Reset() + is.NoError(err) + if runtime.GOOS == "windows" { fd := uintptr(syscall.Stdout) // if run test by goland, will return false