MCPcopy
hub / github.com/golang/protobuf / TestRequiredBit

Function TestRequiredBit

proto/proto_test.go:355–364  ·  view source on GitHub ↗

Do we catch the "required bit not set" case?

(t *testing.T)

Source from the content-addressed store, hash-verified

353
354// Do we catch the "required bit not set" case?
355func TestRequiredBit(t *testing.T) {
356 o := new(proto.Buffer)
357 pb := new(pb2.GoTest)
358 err := o.Marshal(pb)
359 if err == nil {
360 t.Error("did not catch missing required fields")
361 } else if !strings.Contains(err.Error(), "Kind") {
362 t.Error("wrong error type:", err)
363 }
364}
365
366// Check that all fields are nil.
367// Clearly silly, and a residue from a more interesting test with an earlier,

Callers

nothing calls this directly

Calls 2

MarshalMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…