mirror of
https://github.com/gizak/termui.git
synced 2025-04-26 13:48:54 +08:00
21 lines
390 B
Go
21 lines
390 B
Go
package termui
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestParseStyles(t *testing.T) {
|
|
cells := ParseStyles("test [blue](fg:blue)", NewStyle(ColorWhite))
|
|
if cells[0].Style.Fg != 7 {
|
|
t.Fatal("normal text fg is wrong")
|
|
}
|
|
if cells[5].Style.Fg != 4 {
|
|
t.Fatal("blue text fg is wrong")
|
|
}
|
|
|
|
cells = ParseStyles("[hi]", NewStyle(ColorWhite))
|
|
if len(cells) != 4 {
|
|
t.Fatal("missing closing ]")
|
|
}
|
|
}
|