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

Function TestBodySetAttributeTraversal

hclwrite/ast_body_test.go:546–770  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

544}
545
546func TestBodySetAttributeTraversal(t *testing.T) {
547 tests := []struct {
548 src string
549 name string
550 trav string
551 want Tokens
552 }{
553 {
554 "",
555 "a",
556 `b`,
557 Tokens{
558 {
559 Type: hclsyntax.TokenIdent,
560 Bytes: []byte{'a'},
561 SpacesBefore: 0,
562 },
563 {
564 Type: hclsyntax.TokenEqual,
565 Bytes: []byte{'='},
566 SpacesBefore: 1,
567 },
568 {
569 Type: hclsyntax.TokenIdent,
570 Bytes: []byte("b"),
571 SpacesBefore: 1,
572 },
573 {
574 Type: hclsyntax.TokenNewline,
575 Bytes: []byte{'\n'},
576 SpacesBefore: 0,
577 },
578 {
579 Type: hclsyntax.TokenEOF,
580 Bytes: []byte{},
581 SpacesBefore: 0,
582 },
583 },
584 },
585 {
586 "",
587 "a",
588 `b.c.d`,
589 Tokens{
590 {
591 Type: hclsyntax.TokenIdent,
592 Bytes: []byte{'a'},
593 SpacesBefore: 0,
594 },
595 {
596 Type: hclsyntax.TokenEqual,
597 Bytes: []byte{'='},
598 SpacesBefore: 1,
599 },
600 {
601 Type: hclsyntax.TokenIdent,
602 Bytes: []byte("b"),
603 SpacesBefore: 1,

Callers

nothing calls this directly

Calls 8

ParseTraversalAbsFunction · 0.92
formatFunction · 0.85
RunMethod · 0.80
SetAttributeTraversalMethod · 0.80
ParseConfigFunction · 0.70
BuildTokensMethod · 0.65
ErrorMethod · 0.45
BodyMethod · 0.45

Tested by

no test coverage detected