forked from Knetic/govaluate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tokenKind_test.go
47 lines (39 loc) · 862 Bytes
/
tokenKind_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package govaluate
import (
"testing"
)
/*
Tests to make sure that all the different token kinds have different string representations
Gotta get that 95% code coverage yall. That's why tests like this get written; over-reliance on bad metrics.
*/
func TestTokenKindStrings(test *testing.T) {
var kindStrings []string
var kindString string
kinds := []TokenKind{
UNKNOWN,
PREFIX,
NUMERIC,
BOOLEAN,
STRING,
PATTERN,
TIME,
VARIABLE,
COMPARATOR,
LOGICALOP,
MODIFIER,
CLAUSE,
CLAUSE_CLOSE,
TERNARY,
}
for _, kind := range kinds {
kindString = kind.String()
for _, extantKind := range kindStrings {
if extantKind == kindString {
test.Logf("Token kind test found duplicate string for token kind %v ('%v')\n", kind, kindString)
test.Fail()
return
}
}
kindStrings = append(kindStrings, kindString)
}
}