MCPcopy Create free account
hub / github.com/abice/go-enum / TestForceUpperString

Function TestForceUpperString

example/force_upper_test.go:12–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestForceUpperString(t *testing.T) {
13 tests := map[string]struct {
14 input string
15 output ForceUpperType
16 }{
17 "dataswap": {
18 input: `DATASWAP`,
19 output: ForceUpperTypeDataSwap,
20 },
21 "bootnode": {
22 input: `BOOTNODE`,
23 output: ForceUpperTypeBootNode,
24 },
25 }
26
27 for name, tc := range tests {
28 t.Run(name, func(t *testing.T) {
29 output, err := ParseForceUpperType(tc.input)
30 assert.NoError(t, err)
31 assert.Equal(t, tc.output, output)
32
33 assert.Equal(t, tc.input, output.String())
34 })
35 }
36
37 t.Run("failures", func(t *testing.T) {
38 assert.Equal(t, "ForceUpperType(99)", ForceUpperType(99).String())
39 _, err := ParseForceUpperType("-1")
40 assert.Error(t, err)
41 })
42}

Callers

nothing calls this directly

Calls 3

ParseForceUpperTypeFunction · 0.85
ForceUpperTypeTypeAlias · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…