1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-13 13:28:27 +02:00
chroma/coalesce_test.go
Daniel Eloff 9c3abeae1d Tokens by value (#187)
This results in about a 8% improvement in speed.
2018-11-04 10:22:51 +11:00

20 lines
367 B
Go

package chroma
import (
"testing"
"github.com/alecthomas/assert"
)
func TestCoalesce(t *testing.T) {
lexer := Coalesce(MustNewLexer(nil, Rules{
"root": []Rule{
{`[!@#$%^&*()]`, Punctuation, nil},
},
}))
actual, err := Tokenise(lexer, nil, "!@#$")
assert.NoError(t, err)
expected := []Token{{Punctuation, "!@#$"}}
assert.Equal(t, expected, actual)
}