MCPcopy Index your code
hub / github.com/godbus/dbus / TestEncodeMapStringNonEmptyInterface

Function TestEncodeMapStringNonEmptyInterface

encoder_test.go:125–146  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

123func (fooimpl) Foo() {}
124
125func TestEncodeMapStringNonEmptyInterface(t *testing.T) {
126 val := map[string]fooer{"foo": fooimpl("bar")}
127 buf := new(bytes.Buffer)
128 fds := make([]int, 0)
129 order := binary.LittleEndian
130 enc := newEncoder(buf, binary.LittleEndian, fds)
131 err := enc.Encode(val)
132 if err != nil {
133 t.Fatal(err)
134 }
135
136 dec := newDecoder(buf, order, enc.fds)
137 v, err := dec.Decode(SignatureOf(val))
138 if err != nil {
139 t.Fatal(err)
140 }
141 out := map[string]fooer{}
142 err = Store(v, &out)
143 if err == nil {
144 t.Fatal("Shouldn't be able to convert to non empty interfaces")
145 }
146}
147
148func TestEncodeSliceInterface(t *testing.T) {
149 val := []any{"foo", "bar"}

Callers

nothing calls this directly

Calls 7

fooimplTypeAlias · 0.85
newEncoderFunction · 0.85
newDecoderFunction · 0.85
SignatureOfFunction · 0.85
StoreFunction · 0.85
EncodeMethod · 0.80
DecodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…