blob: 05045b0f85ae332b6ecb388e5f26e549d80725c1 [file] [log] [blame]
Sketch🕴️d04f3622026-02-28 19:09:06 +04001package token
2
3import "testing"
4
5func TestTypeString(t *testing.T) {
6 tests := []struct {
7 typ Type
8 want string
9 }{
10 {Number, "Number"},
11 {Plus, "+"},
12 {Minus, "-"},
13 {Star, "*"},
14 {Slash, "/"},
15 {LParen, "("},
16 {RParen, ")"},
17 {EOF, "EOF"},
18 {Type(99), "Unknown(99)"},
19 }
20 for _, tc := range tests {
21 if got := tc.typ.String(); got != tc.want {
22 t.Errorf("Type(%d).String() = %q, want %q", int(tc.typ), got, tc.want)
23 }
24 }
25}