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:
30
style_test.go
Normal file
30
style_test.go
Normal 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))
|
||||
}
|
Reference in New Issue
Block a user