This repository has been archived by the owner on Jul 28, 2020. It is now read-only.
/
ansi_test.go
99 lines (82 loc) · 2.27 KB
/
ansi_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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package ansi
import (
"testing"
"github.com/zhevron/match"
)
func TestBlack(t *testing.T) {
str := Black("test", None)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[30mtest\033[0m")
}
func TestRed(t *testing.T) {
str := Red("test", None)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[31mtest\033[0m")
}
func TestGreen(t *testing.T) {
str := Green("test", None)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[32mtest\033[0m")
}
func TestYellow(t *testing.T) {
str := Yellow("test", None)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[33mtest\033[0m")
}
func TestBlue(t *testing.T) {
str := Blue("test", None)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[34mtest\033[0m")
}
func TestMagenta(t *testing.T) {
str := Magenta("test", None)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[35mtest\033[0m")
}
func TestCyan(t *testing.T) {
str := Cyan("test", None)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[36mtest\033[0m")
}
func TestWhite(t *testing.T) {
str := White("test", None)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[37mtest\033[0m")
}
func TestColorString_Light(t *testing.T) {
str := Black("test", Light)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[90mtest\033[0m")
}
func TestColorString_Bold(t *testing.T) {
str := Black("test", Bold)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[30;1mtest\033[0m")
}
func TestColorString_Italic(t *testing.T) {
str := Black("test", Italic)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[30;3mtest\033[0m")
}
func TestColorString_Underline(t *testing.T) {
str := Black("test", Underline)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[30;4mtest\033[0m")
}
func TestColorString_Blink(t *testing.T) {
str := Black("test", Blink)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[30;5mtest\033[0m")
}
func TestColorString_Combined(t *testing.T) {
str := Black("test", Bold|Underline)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "\033[30;1;4mtest\033[0m")
}
func TestColorString_Disabled(t *testing.T) {
Disable()
str := Black("test", None)
match.GreaterThan(t, len(str), 0)
match.Equals(t, str, "test")
Enable()
}