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

Function TestEncodeIntToNonCovertible

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

Source from the content-addressed store, hash-verified

286}
287
288func TestEncodeIntToNonCovertible(t *testing.T) {
289 val := 150
290 buf := new(bytes.Buffer)
291 fds := make([]int, 0)
292 order := binary.LittleEndian
293 enc := newEncoder(buf, binary.LittleEndian, fds)
294 err := enc.Encode(val)
295 if err != nil {
296 t.Fatal(err)
297 }
298
299 dec := newDecoder(buf, order, enc.fds)
300 v, err := dec.Decode(SignatureOf(val))
301 if err != nil {
302 t.Fatal(err)
303 }
304 var out bool
305 err = Store(v, &out)
306 if err == nil {
307 t.Logf("%t\n", out)
308 t.Fatal("Type mismatch should have occurred")
309 }
310}
311
312func TestEncodeUint(t *testing.T) {
313 val := uint(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…