MCPcopy Create free account
hub / github.com/blevesearch/bleve / TestMappingStructWithPointerToString

Function TestMappingStructWithPointerToString

mapping/mapping_test.go:249–280  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

247}
248
249func TestMappingStructWithPointerToString(t *testing.T) {
250
251 mapping := buildMapping()
252
253 name := "marty"
254
255 x := struct {
256 Name *string
257 }{
258 Name: &name,
259 }
260
261 doc := document.NewDocument("1")
262 err := mapping.MapDocument(doc, x)
263 if err != nil {
264 t.Fatal(err)
265 }
266 found := false
267 count := 0
268 for _, f := range doc.Fields {
269 if f.Name() == "Name" {
270 found = true
271 }
272 count++
273 }
274 if !found {
275 t.Errorf("expected to find field named 'Name'")
276 }
277 if count != 1 {
278 t.Errorf("expected to find 1 find, found %d", count)
279 }
280}
281
282func TestMappingJSONWithNull(t *testing.T) {
283

Callers

nothing calls this directly

Calls 4

NewDocumentFunction · 0.92
buildMappingFunction · 0.70
MapDocumentMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…