1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-01-14 02:23:16 +02:00
chroma/coalesce_test.go

20 lines
381 B
Go
Raw Normal View History

2017-06-01 16:17:21 +02:00
package chroma
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestCoalesce(t *testing.T) {
lexer := Coalesce(MustNewLexer(nil, Rules{
2017-06-01 16:17:21 +02:00
"root": []Rule{
2017-09-15 14:18:20 +02:00
Rule{`[!@#$%^&*()]`, Punctuation, nil},
2017-06-01 16:17:21 +02:00
},
}))
actual, err := Tokenise(lexer, nil, "!@#$")
2017-06-01 16:17:21 +02:00
require.NoError(t, err)
expected := []*Token{{Punctuation, "!@#$"}}
2017-06-01 16:17:21 +02:00
require.Equal(t, expected, actual)
}