mirror of https://github.com/junegunn/fzf
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
399 B
Go
21 lines
399 B
Go
package tui
|
|
|
|
import "testing"
|
|
|
|
func TestHexToColor(t *testing.T) {
|
|
assert := func(expr string, r, g, b int) {
|
|
color := HexToColor(expr)
|
|
if !color.is24() ||
|
|
int((color>>16)&0xff) != r ||
|
|
int((color>>8)&0xff) != g ||
|
|
int((color)&0xff) != b {
|
|
t.Fail()
|
|
}
|
|
}
|
|
|
|
assert("#ff0000", 255, 0, 0)
|
|
assert("#010203", 1, 2, 3)
|
|
assert("#102030", 16, 32, 48)
|
|
assert("#ffffff", 255, 255, 255)
|
|
}
|