File tree 1 file changed +14
-13
lines changed
1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -63,24 +63,12 @@ func Example() {
63
63
func TestSet (t * testing.T ) {
64
64
is := assert .New (t )
65
65
66
- // set enable
67
- Enable = true
68
66
fmt .Println ("support color:" , SupportColor ())
69
67
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 )
80
68
81
69
// disable
82
70
old := Disable ()
83
- num , err = Set (FgGreen )
71
+ num , err : = Set (FgGreen )
84
72
is .Nil (err )
85
73
is .Equal (0 , num )
86
74
@@ -89,6 +77,19 @@ func TestSet(t *testing.T) {
89
77
is .Equal (0 , num )
90
78
Enable = old // revert
91
79
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
+
92
93
if runtime .GOOS == "windows" {
93
94
fd := uintptr (syscall .Stdout )
94
95
// if run test by goland, will return false
You can’t perform that action at this time.
0 commit comments