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

Function TestDecoderStringPoolError

decode_string_test.go:662–679  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

660}
661
662func TestDecoderStringPoolError(t *testing.T) {
663 // reset the pool to make sure it's not full
664 decPool = sync.Pool{
665 New: func() interface{} {
666 return NewDecoder(nil)
667 },
668 }
669 result := ""
670 dec := NewDecoder(nil)
671 dec.Release()
672 defer func() {
673 err := recover()
674 assert.NotNil(t, err, "err shouldnt be nil")
675 assert.IsType(t, InvalidUsagePooledDecoderError(""), err, "err should be of type InvalidUsagePooledDecoderError")
676 }()
677 _ = dec.DecodeString(&result)
678 assert.True(t, false, "should not be called as decoder should have panicked")
679}
680
681func TestDecoderSkipEscapedStringError(t *testing.T) {
682 dec := NewDecoder(strings.NewReader(``))

Callers

nothing calls this directly

Calls 4

ReleaseMethod · 0.95
DecodeStringMethod · 0.95
NewDecoderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…