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

23 lines
416 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, err := Coalesce(MustNewLexer(nil, Rules{
"root": []Rule{
Rule{`[[:punct:]]`, Punctuation, nil},
},
}))
require.NoError(t, err)
actual, err := lexer.Tokenise("!@#$%")
require.NoError(t, err)
expected := []Token{
Token{Punctuation, "!@#$%"},
}
require.Equal(t, expected, actual)
}