MCPcopy Create free account
hub / github.com/google/go-cloud / TestDecodeFail

Function TestDecodeFail

docstore/driver/codec_test.go:583–595  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

581}
582
583func TestDecodeFail(t *testing.T) {
584 // Verify that failure to decode a value results in an error.
585 for _, in := range []any{
586 new(any), new(bool), new(string), new(int), new(uint), new(float32),
587 new([]byte), new([]int), new(map[string]any),
588 } {
589 dec := &failDecoder{}
590 err := Decode(reflect.ValueOf(in).Elem(), dec)
591 if e, ok := err.(*gcerr.Error); !ok || err == nil || e.Code != gcerr.InvalidArgument {
592 t.Errorf("%T: got %v, want InvalidArgument Error", in, err)
593 }
594 }
595}
596
597type testDecoder struct {
598 val any // assume encoded by testEncoder.

Callers

nothing calls this directly

Calls 1

DecodeFunction · 0.70

Tested by

no test coverage detected