1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-05 13:05:18 +02:00
chroma/coalesce_test.go

20 lines
368 B
Go
Raw Normal View History

2017-06-02 00:17:21 +10:00
package chroma
import (
"testing"
"github.com/alecthomas/assert"
2017-06-02 00:17:21 +10:00
)
func TestCoalesce(t *testing.T) {
lexer := Coalesce(MustNewLexer(nil, Rules{
2017-06-02 00:17:21 +10:00
"root": []Rule{
2017-09-26 22:05:44 +10:00
{`[!@#$%^&*()]`, Punctuation, nil},
2017-06-02 00:17:21 +10:00
},
}))
actual, err := Tokenise(lexer, nil, "!@#$")
assert.NoError(t, err)
expected := []*Token{{Punctuation, "!@#$"}}
assert.Equal(t, expected, actual)
2017-06-02 00:17:21 +10:00
}