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

Function TestEncoderStringNullEmpty

encode_string_test.go:166–199  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

164}
165
166func TestEncoderStringNullEmpty(t *testing.T) {
167 var testCases = []struct {
168 name string
169 baseJSON string
170 expectedJSON string
171 }{
172 {
173 name: "basic 1st elem",
174 baseJSON: "[",
175 expectedJSON: `[null,"true"`,
176 },
177 {
178 name: "basic 2nd elem",
179 baseJSON: `["test"`,
180 expectedJSON: `["test",null,"true"`,
181 },
182 {
183 name: "basic 2nd elem",
184 baseJSON: `["test"`,
185 expectedJSON: `["test",null,"true"`,
186 },
187 }
188 for _, testCase := range testCases {
189 t.Run("true", func(t *testing.T) {
190 var b strings.Builder
191 var enc = NewEncoder(&b)
192 enc.writeString(testCase.baseJSON)
193 enc.StringNullEmpty("")
194 enc.AddStringNullEmpty("true")
195 enc.Write()
196 assert.Equal(t, testCase.expectedJSON, b.String())
197 })
198 }
199}
200
201func TestEncoderStringNullEmpty2(t *testing.T) {
202 var testCases = []struct {

Callers

nothing calls this directly

Calls 6

NewEncoderFunction · 0.85
writeStringMethod · 0.80
StringNullEmptyMethod · 0.80
AddStringNullEmptyMethod · 0.80
WriteMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…