MCPcopy Create free account
hub / github.com/godbus/dbus / TestEncodeSliceNamedInterface

Function TestEncodeSliceNamedInterface

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

Source from the content-addressed store, hash-verified

197}
198
199func TestEncodeSliceNamedInterface(t *testing.T) {
200 val := []empty{"foo", "bar"}
201 buf := new(bytes.Buffer)
202 fds := make([]int, 0)
203 order := binary.LittleEndian
204 enc := newEncoder(buf, binary.LittleEndian, fds)
205 err := enc.Encode(val)
206 if err != nil {
207 t.Fatal(err)
208 }
209
210 dec := newDecoder(buf, order, enc.fds)
211 v, err := dec.Decode(SignatureOf(val))
212 if err != nil {
213 t.Fatal(err)
214 }
215 out := []empty{}
216 if err := Store(v, &out); err != nil {
217 t.Fatal(err)
218 }
219 if !reflect.DeepEqual(out, val) {
220 t.Errorf("not equal: got '%v', want '%v'",
221 out, val)
222 }
223}
224
225func TestEncodeNestedInterface(t *testing.T) {
226 val := map[string]any{

Callers

nothing calls this directly

Calls 6

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…