Codebase list golang-github-alecthomas-chroma / v0.9.0 coalesce_test.go
v0.9.0

Tree @v0.9.0 (Download .tar.gz)

coalesce_test.go @v0.9.0raw · history · blame

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