blob: 05045b0f85ae332b6ecb388e5f26e549d80725c1 [file] [log] [blame]
package token
import "testing"
func TestTypeString(t *testing.T) {
tests := []struct {
typ Type
want string
}{
{Number, "Number"},
{Plus, "+"},
{Minus, "-"},
{Star, "*"},
{Slash, "/"},
{LParen, "("},
{RParen, ")"},
{EOF, "EOF"},
{Type(99), "Unknown(99)"},
}
for _, tc := range tests {
if got := tc.typ.String(); got != tc.want {
t.Errorf("Type(%d).String() = %q, want %q", int(tc.typ), got, tc.want)
}
}
}