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

Function TestForceLowerString

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

Source from the content-addressed store, hash-verified

10)
11
12func TestForceLowerString(t *testing.T) {
13 tests := map[string]struct {
14 input string
15 output ForceLowerType
16 }{
17 "dataswap": {
18 input: `dataswap`,
19 output: ForceLowerTypeDataSwap,
20 },
21 "bootnode": {
22 input: `bootnode`,
23 output: ForceLowerTypeBootNode,
24 },
25 }
26
27 for name, tc := range tests {
28 t.Run(name, func(t *testing.T) {
29 output, err := ParseForceLowerType(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, "ForceLowerType(99)", ForceLowerType(99).String())
39 _, err := ParseForceLowerType("-1")
40 assert.Error(t, err)
41 })
42}

Callers

nothing calls this directly

Calls 3

ParseForceLowerTypeFunction · 0.85
ForceLowerTypeTypeAlias · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…