2017-06-06 21:23:50 +10:00
|
|
|
package chroma
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStyleInherit(t *testing.T) {
|
2017-09-21 12:54:18 +10:00
|
|
|
s, err := NewStyle("test", StyleEntries{
|
2017-06-06 21:23:50 +10:00
|
|
|
Name: "bold #f00",
|
|
|
|
NameVariable: "#fff",
|
|
|
|
})
|
2017-09-21 12:54:18 +10:00
|
|
|
require.NoError(t, err)
|
2017-06-06 21:23:50 +10:00
|
|
|
require.Equal(t, &StyleEntry{Colour: 0x1000000, Bold: true}, s.Get(NameVariable))
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestColours(t *testing.T) {
|
2017-09-21 12:54:18 +10:00
|
|
|
s, err := NewStyle("test", StyleEntries{
|
2017-06-06 21:23:50 +10:00
|
|
|
Name: "#f00 bg:#001 border:#ansiblue",
|
|
|
|
})
|
2017-09-21 12:54:18 +10:00
|
|
|
require.NoError(t, err)
|
2017-06-06 21:23:50 +10:00
|
|
|
require.Equal(t, &StyleEntry{Colour: 0xff0001, Background: 0x000012, Border: 0x000100}, s.Get(Name))
|
|
|
|
}
|