forked from lyft/protoc-gen-star
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wkt_test.go
58 lines (48 loc) · 1002 Bytes
/
wkt_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
48
49
50
51
52
53
54
55
56
57
58
package pgs
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestLookupWKT(t *testing.T) {
t.Parallel()
tests := []struct {
name Name
expected WellKnownType
}{
{"Any", AnyWKT},
{"Duration", DurationWKT},
{"Empty", EmptyWKT},
{"Foobar", UnknownWKT},
}
for _, test := range tests {
tc := test
t.Run(tc.name.String(), func(t *testing.T) {
t.Parallel()
assert.Equal(t, tc.expected, LookupWKT(tc.name))
})
}
}
func TestWellKnownType_Name(t *testing.T) {
t.Parallel()
wkt := WellKnownType("Foobar")
assert.Equal(t, Name("Foobar"), wkt.Name())
}
func TestWellKnownType_Valid(t *testing.T) {
t.Parallel()
tests := []struct {
wkt WellKnownType
expected bool
}{
{AnyWKT, true},
{Int64ValueWKT, true},
{UnknownWKT, false},
{WellKnownType("Foobar"), false},
}
for _, test := range tests {
tc := test
t.Run(tc.wkt.Name().String(), func(t *testing.T) {
t.Parallel()
assert.Equal(t, tc.expected, tc.wkt.Valid())
})
}
}