2020-02-13 20:34:50 +00:00
|
|
|
package kv
|
|
|
|
|
|
|
|
import (
|
2020-07-01 04:00:49 +00:00
|
|
|
"context"
|
2020-02-13 20:34:50 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
testpb "github.com/prysmaticlabs/prysm/proto/testing"
|
2021-09-23 18:53:46 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
2020-02-13 20:34:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func Test_encode_handlesNilFromFunction(t *testing.T) {
|
|
|
|
foo := func() *testpb.Puzzle {
|
|
|
|
return nil
|
|
|
|
}
|
2020-07-01 04:00:49 +00:00
|
|
|
_, err := encode(context.Background(), foo())
|
2020-08-08 18:39:01 +00:00
|
|
|
require.ErrorContains(t, "cannot encode nil message", err)
|
2020-02-13 20:34:50 +00:00
|
|
|
}
|