MCPcopy Create free account
hub / github.com/rilldata/rill / TestCodecComplex

Function TestCodecComplex

runtime/pkg/securetoken/securetoken_test.go:23–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21}
22
23func TestCodecComplex(t *testing.T) {
24 type Complex struct {
25 A string
26 B int
27 }
28
29 c := NewRandom()
30 v := &Complex{A: "hello world", B: 42}
31 tkn, err := c.Encode(v)
32 require.NoError(t, err)
33 res := &Complex{}
34 err = c.Decode(tkn, res)
35 require.NoError(t, err)
36 require.Equal(t, v, res)
37
38 err = c.Decode("invalid token", res)
39 require.Error(t, err)
40}

Callers

nothing calls this directly

Calls 4

EncodeMethod · 0.80
NewRandomFunction · 0.70
DecodeMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected