-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathforce_upper_test.go
More file actions
42 lines (35 loc) · 805 Bytes
/
Copy pathforce_upper_test.go
File metadata and controls
42 lines (35 loc) · 805 Bytes
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
//go:build example
// +build example
package example
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestForceUpperString(t *testing.T) {
tests := map[string]struct {
input string
output ForceUpperType
}{
"dataswap": {
input: `DATASWAP`,
output: ForceUpperTypeDataSwap,
},
"bootnode": {
input: `BOOTNODE`,
output: ForceUpperTypeBootNode,
},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
output, err := ParseForceUpperType(tc.input)
assert.NoError(t, err)
assert.Equal(t, tc.output, output)
assert.Equal(t, tc.input, output.String())
})
}
t.Run("failures", func(t *testing.T) {
assert.Equal(t, "ForceUpperType(99)", ForceUpperType(99).String())
_, err := ParseForceUpperType("-1")
assert.Error(t, err)
})
}