Codebase list golang-github-alecthomas-chroma / upstream/0.9.4+git20211110.1.d6e61d3 coalesce_test.go
upstream/0.9.4+git20211110.1.d6e61d3

Tree @upstream/0.9.4+git20211110.1.d6e61d3 (Download .tar.gz)

coalesce_test.go @upstream/0.9.4+git20211110.1.d6e61d3raw · history · blame

package chroma

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

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