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

Function TestProductString

example/custom_prefix_test.go:18–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16}
17
18func TestProductString(t *testing.T) {
19 x := Product(109)
20 assert.Equal(t, "Product(109)", x.String())
21 x = Product(1)
22 assert.Equal(t, "Dynamite", x.String())
23
24 y, err := ParseProduct("Anvil")
25 require.NoError(t, err, "Failed parsing anvil")
26 assert.Equal(t, AcmeIncProductAnvil, y)
27
28 z, err := ParseProduct("Snake")
29 require.Error(t, err, "Shouldn't parse a snake")
30 assert.Equal(t, Product(0), z)
31}
32
33func TestProductUnmarshal(t *testing.T) {
34 tests := []struct {

Callers

nothing calls this directly

Calls 3

ProductTypeAlias · 0.85
ParseProductFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…