MCPcopy
hub / github.com/google/ax / assertMimeCoverage

Function assertMimeCoverage

internal/experimental/a2abridge/mappings_test.go:54–70  ·  view source on GitHub ↗
(t *testing.T, desc protoreflect.EnumDescriptor, has func(int32) bool)

Source from the content-addressed store, hash-verified

52}
53
54func assertMimeCoverage(t *testing.T, desc protoreflect.EnumDescriptor, has func(int32) bool) {
55 t.Helper()
56 var missing []string
57 values := desc.Values()
58 for i := 0; i < values.Len(); i++ {
59 v := values.Get(i)
60 if int32(v.Number()) == 0 {
61 continue // UNSPECIFIED; intentionally not mapped
62 }
63 if !has(int32(v.Number())) {
64 missing = append(missing, string(v.Name()))
65 }
66 }
67 if len(missing) > 0 {
68 t.Errorf("mime_map missing wire-string entries for: %v (add the wire MIME string to the corresponding forward map in mime_map.go)", missing)
69 }
70}

Callers 1

TestMimeTableCoverageFunction · 0.85

Calls 3

GetMethod · 0.80
NameMethod · 0.65
NumberMethod · 0.45

Tested by

no test coverage detected