MCPcopy Create free account
hub / github.com/francoispqt/gojay / TestDecodeStreamDecodePooledDecoderError2

Function TestDecodeStreamDecodePooledDecoderError2

decode_stream_pool_test.go:39–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestDecodeStreamDecodePooledDecoderError2(t *testing.T) {
40 // we override the pool chan
41 dec := Stream.NewDecoder(nil)
42 dec.Release()
43 defer func() {
44 err := recover()
45 assert.NotNil(t, err, "err shouldnt be nil")
46 assert.IsType(t, InvalidUsagePooledDecoderError(""), err, "err should be of type InvalidUsagePooledDecoderError")
47 assert.Equal(t, "Invalid usage of pooled decoder", err.(InvalidUsagePooledDecoderError).Error(), "err should be of type InvalidUsagePooledDecoderError")
48 }()
49 var v = TestObj{}
50 dec.DecodeObject(&v)
51 // make sure they are the same
52 assert.True(t, false, "should not be called as decoder should have panicked")
53}
54
55func TestStreamDecoderNewPool(t *testing.T) {
56 dec := newStreamDecoderPool()

Callers

nothing calls this directly

Calls 5

ReleaseMethod · 0.95
DecodeObjectMethod · 0.95
NewDecoderMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…