17 lines
450 B
Go
17 lines
450 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) {
|
|
tokens := token.Tokenize([]byte(`a b b c c c`))
|
|
assert.Equal(t, token.Count(tokens, token.Identifier, "a"), 1)
|
|
assert.Equal(t, token.Count(tokens, token.Identifier, "b"), 2)
|
|
assert.Equal(t, token.Count(tokens, token.Identifier, "c"), 3)
|
|
assert.Equal(t, token.Count(tokens, token.Identifier, "d"), 0)
|
|
}
|