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

Function TestEncodeMapStringInterface

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

Source from the content-addressed store, hash-verified

61}
62
63func TestEncodeMapStringInterface(t *testing.T) {
64 val := map[string]any{"foo": "bar"}
65 buf := new(bytes.Buffer)
66 fds := make([]int, 0)
67 order := binary.LittleEndian
68 enc := newEncoder(buf, binary.LittleEndian, fds)
69 err := enc.Encode(val)
70 if err != nil {
71 t.Fatal(err)
72 }
73
74 dec := newDecoder(buf, order, enc.fds)
75 v, err := dec.Decode(SignatureOf(val))
76 if err != nil {
77 t.Fatal(err)
78 }
79 out := map[string]any{}
80 if err := Store(v, &out); err != nil {
81 t.Fatal(err)
82 }
83 if !reflect.DeepEqual(out, val) {
84 t.Errorf("not equal: got '%v', want '%v'",
85 out, val)
86 }
87}
88
89type empty any
90

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…