mirror of
https://github.com/alecthomas/chroma.git
synced 2025-07-13 01:10:14 +02:00
23 lines
416 B
Go
23 lines
416 B
Go
![]() |
package chroma
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestCoalesce(t *testing.T) {
|
||
|
lexer, err := Coalesce(MustNewLexer(nil, Rules{
|
||
|
"root": []Rule{
|
||
|
Rule{`[[:punct:]]`, Punctuation, nil},
|
||
|
},
|
||
|
}))
|
||
|
require.NoError(t, err)
|
||
|
actual, err := lexer.Tokenise("!@#$%")
|
||
|
require.NoError(t, err)
|
||
|
expected := []Token{
|
||
|
Token{Punctuation, "!@#$%"},
|
||
|
}
|
||
|
require.Equal(t, expected, actual)
|
||
|
}
|