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