MCPcopy
hub / github.com/hashicorp/hcl / TestMergeBodiesPartialContent

Function TestMergeBodiesPartialContent

merged_test.go:357–562  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

355}
356
357func TestMergeBodiesPartialContent(t *testing.T) {
358 tests := []struct {
359 Bodies []Body
360 Schema *BodySchema
361 WantContent *BodyContent
362 WantRemain Body
363 DiagCount int
364 }{
365 {
366 []Body{},
367 &BodySchema{},
368 &BodyContent{
369 Attributes: map[string]*Attribute{},
370 },
371 mergedBodies{},
372 0,
373 },
374 {
375 []Body{
376 &testMergedBodiesVictim{
377 Name: "first",
378 HasAttributes: []string{"name", "age"},
379 },
380 },
381 &BodySchema{
382 Attributes: []AttributeSchema{
383 {
384 Name: "name",
385 },
386 },
387 },
388 &BodyContent{
389 Attributes: map[string]*Attribute{
390 "name": &Attribute{
391 Name: "name",
392 NameRange: Range{Filename: "first"},
393 },
394 },
395 },
396 mergedBodies{
397 &testMergedBodiesVictim{
398 Name: "first",
399 HasAttributes: []string{"age"},
400 },
401 },
402 0,
403 },
404 {
405 []Body{
406 &testMergedBodiesVictim{
407 Name: "first",
408 HasAttributes: []string{"name", "age"},
409 },
410 &testMergedBodiesVictim{
411 Name: "second",
412 HasAttributes: []string{"name", "pizza"},
413 },
414 },

Callers

nothing calls this directly

Calls 3

MergeBodiesFunction · 0.85
RunMethod · 0.80
PartialContentMethod · 0.65

Tested by

no test coverage detected