18 lines
500 B
Go
18 lines
500 B
Go
package token_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.akyoto.dev/cli/q/src/build/token"
|
|
"git.akyoto.dev/go/assert"
|
|
)
|
|
|
|
func TestCount(t *testing.T) {
|
|
buffer := []byte(`a b b c c c`)
|
|
tokens := token.Tokenize(buffer)
|
|
assert.Equal(t, token.Count(tokens, buffer, token.Identifier, "a"), 1)
|
|
assert.Equal(t, token.Count(tokens, buffer, token.Identifier, "b"), 2)
|
|
assert.Equal(t, token.Count(tokens, buffer, token.Identifier, "c"), 3)
|
|
assert.Equal(t, token.Count(tokens, buffer, token.Identifier, "d"), 0)
|
|
}
|