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

23 lines
412 B
Go
Raw Normal View History

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