-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrainbow_test.go
More file actions
34 lines (28 loc) · 904 Bytes
/
rainbow_test.go
File metadata and controls
34 lines (28 loc) · 904 Bytes
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
package rainbow
import (
"testing"
)
// Test params on a Color Decorator
func TestColor(t *testing.T) {
if Blue("MyString") != "\x1b[34m"+"MyString"+"\u001b[0m" {
t.Error("Two black colors are not equal")
}
}
func TestColorBright(t *testing.T) {
if RedBright("MyString") != "\x1b[91m"+"MyString"+"\u001b[0m" {
t.Error("Red bright colors don't match colors are not equal")
}
}
func TestBgColorBright(t *testing.T) {
if GreenBright(BgBlueBright("MyString")) != "\x1b[92m"+"\x1b[104m"+"MyString"+"\u001b[0m"+"\u001b[0m" {
t.Error("Red bright colors don't match colors are not equal")
}
}
func TestNestedStyles(t *testing.T) {
if Underscore(GreenBright("foo")) != "\x1b[4m"+"\x1b[92m"+"foo"+"\u001b[0m"+"\u001b[0m" {
t.Error("Nesting of styles fails")
}
if BgBlack(GreenBright("foo")) != "\x1b[40m"+"\x1b[92m"+"foo"+"\u001b[0m"+"\u001b[0m" {
t.Error("Nesting of styles fails")
}
}