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

Function TestCodecSimple

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

Source from the content-addressed store, hash-verified

7)
8
9func TestCodecSimple(t *testing.T) {
10 c := NewRandom()
11 s := "hello world"
12 tkn, err := c.Encode(s)
13 require.NoError(t, err)
14 var res string
15 err = c.Decode(tkn, &res)
16 require.NoError(t, err)
17 require.Equal(t, s, res)
18
19 err = c.Decode("invalid token", &res)
20 require.Error(t, err)
21}
22
23func TestCodecComplex(t *testing.T) {
24 type Complex struct {

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