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

Function TestLinesForFormat

hclwrite/format_test.go:653–800  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

651}
652
653func TestLinesForFormat(t *testing.T) {
654 tests := []struct {
655 tokens Tokens
656 want []formatLine
657 }{
658 {
659 Tokens{
660 &Token{Type: hclsyntax.TokenEOF},
661 },
662 []formatLine{
663 {
664 lead: Tokens{},
665 },
666 },
667 },
668 {
669 Tokens{
670 &Token{Type: hclsyntax.TokenIdent},
671 &Token{Type: hclsyntax.TokenEOF},
672 },
673 []formatLine{
674 {
675 lead: Tokens{
676 &Token{Type: hclsyntax.TokenIdent},
677 },
678 },
679 },
680 },
681 {
682 Tokens{
683 &Token{Type: hclsyntax.TokenIdent},
684 &Token{Type: hclsyntax.TokenNewline},
685 &Token{Type: hclsyntax.TokenNumberLit},
686 &Token{Type: hclsyntax.TokenEOF},
687 },
688 []formatLine{
689 {
690 lead: Tokens{
691 &Token{Type: hclsyntax.TokenIdent},
692 &Token{Type: hclsyntax.TokenNewline},
693 },
694 },
695 {
696 lead: Tokens{
697 &Token{Type: hclsyntax.TokenNumberLit},
698 },
699 },
700 },
701 },
702 {
703 Tokens{
704 &Token{Type: hclsyntax.TokenIdent},
705 &Token{Type: hclsyntax.TokenComment, Bytes: []byte("#foo\n")},
706 &Token{Type: hclsyntax.TokenNumberLit},
707 &Token{Type: hclsyntax.TokenEOF},
708 },
709 []formatLine{
710 {

Callers

nothing calls this directly

Calls 2

linesForFormatFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected