prysm-pulse/beacon-chain/db/kv/encoding_test.go
Preston Van Loon 4072eb711f
Beacon State: More consistent nil return for state (#4854)
* More consistent nil return for state
* Merge refs/heads/master into nil-state
* Add a check for encode(nil)
* Merge branch 'nil-state' of github.com:prysmaticlabs/prysm into nil-state
* fix test, thanks @rauljordan
* fix tests
* gofmt
2020-02-13 20:34:50 +00:00

18 lines
322 B
Go

package kv
import (
"testing"
testpb "github.com/prysmaticlabs/prysm/proto/testing"
)
func Test_encode_handlesNilFromFunction(t *testing.T) {
foo := func() *testpb.Puzzle {
return nil
}
_, err := encode(foo())
if err == nil || err.Error() != "cannot encode nil message" {
t.Fatalf("Wrong error %v", err)
}
}