(t *testing.T)
| 247 | } |
| 248 | |
| 249 | func 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 | |
| 282 | func TestMappingJSONWithNull(t *testing.T) { |
| 283 |
nothing calls this directly
no test coverage detected
searching dependent graphs…