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

Function TestBodyJustAttributes

hclsyntax/structure_test.go:422–530  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

420}
421
422func TestBodyJustAttributes(t *testing.T) {
423 tests := []struct {
424 body *Body
425 want hcl.Attributes
426 diagCount int
427 }{
428 {
429 &Body{},
430 hcl.Attributes{},
431 0,
432 },
433 {
434 &Body{
435 Attributes: Attributes{},
436 },
437 hcl.Attributes{},
438 0,
439 },
440 {
441 &Body{
442 Attributes: Attributes{
443 "foo": &Attribute{
444 Name: "foo",
445 Expr: &LiteralValueExpr{
446 Val: cty.StringVal("bar"),
447 },
448 },
449 },
450 },
451 hcl.Attributes{
452 "foo": &hcl.Attribute{
453 Name: "foo",
454 Expr: &LiteralValueExpr{
455 Val: cty.StringVal("bar"),
456 },
457 },
458 },
459 0,
460 },
461 {
462 &Body{
463 Attributes: Attributes{
464 "foo": &Attribute{
465 Name: "foo",
466 Expr: &LiteralValueExpr{
467 Val: cty.StringVal("bar"),
468 },
469 },
470 },
471 Blocks: Blocks{
472 {
473 Type: "foo",
474 },
475 },
476 },
477 hcl.Attributes{
478 "foo": &hcl.Attribute{
479 Name: "foo",

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
JustAttributesMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected