debian-mirror-gitlab/workhorse-vendor/github.com/alecthomas/chroma/coalesce_test.go
2022-12-03 16:09:56 +05:30

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)
}