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

Function TestEncodeNestedInterface

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

Source from the content-addressed store, hash-verified

223}
224
225func TestEncodeNestedInterface(t *testing.T) {
226 val := map[string]any{
227 "foo": []any{
228 "1", "2", "3", "5",
229 map[string]any{
230 "bar": "baz",
231 },
232 },
233 "bar": map[string]any{
234 "baz": "quux",
235 "quux": "quuz",
236 },
237 }
238 buf := new(bytes.Buffer)
239 fds := make([]int, 0)
240 order := binary.LittleEndian
241 enc := newEncoder(buf, binary.LittleEndian, fds)
242 err := enc.Encode(val)
243 if err != nil {
244 t.Fatal(err)
245 }
246
247 dec := newDecoder(buf, order, enc.fds)
248 v, err := dec.Decode(SignatureOf(val))
249 if err != nil {
250 t.Fatal(err)
251 }
252 out := map[string]any{}
253 if err := Store(v, &out); err != nil {
254 t.Fatal(err)
255 }
256 if !reflect.DeepEqual(out, val) {
257 t.Errorf("not equal: got '%#v', want '%#v'",
258 out, val)
259 }
260}
261
262func TestEncodeInt(t *testing.T) {
263 val := 10

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…