1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-07-09 00:55:44 +02:00

Move style and formatter API into chroma package.

This commit is contained in:
Alec Thomas
2017-06-06 21:23:50 +10:00
parent ef4a53333b
commit d852022f8d
15 changed files with 261 additions and 253 deletions

30
style_test.go Normal file
View File

@ -0,0 +1,30 @@
package chroma
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestStyleAddNoInherit(t *testing.T) {
s := NewStyle("test", StyleEntries{
Name: "bold #f00",
NameVariable: "noinherit #fff",
})
require.Equal(t, &StyleEntry{Colour: 0x1000000}, s.Get(NameVariable))
}
func TestStyleInherit(t *testing.T) {
s := NewStyle("test", StyleEntries{
Name: "bold #f00",
NameVariable: "#fff",
})
require.Equal(t, &StyleEntry{Colour: 0x1000000, Bold: true}, s.Get(NameVariable))
}
func TestColours(t *testing.T) {
s := NewStyle("test", StyleEntries{
Name: "#f00 bg:#001 border:#ansiblue",
})
require.Equal(t, &StyleEntry{Colour: 0xff0001, Background: 0x000012, Border: 0x000100}, s.Get(Name))
}