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

Function TestScanTokens_template

hclsyntax/scan_tokens_test.go:2664–2852  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2662}
2663
2664func TestScanTokens_template(t *testing.T) {
2665 tests := []struct {
2666 input string
2667 want []Token
2668 }{
2669 // Empty input
2670 {
2671 ``,
2672 []Token{
2673 {
2674 Type: TokenEOF,
2675 Bytes: []byte{},
2676 Range: hcl.Range{
2677 Start: hcl.Pos{Byte: 0, Line: 1, Column: 1},
2678 End: hcl.Pos{Byte: 0, Line: 1, Column: 1},
2679 },
2680 },
2681 },
2682 },
2683
2684 // Simple literals
2685 {
2686 ` hello `,
2687 []Token{
2688 {
2689 Type: TokenStringLit,
2690 Bytes: []byte(` hello `),
2691 Range: hcl.Range{
2692 Start: hcl.Pos{Byte: 0, Line: 1, Column: 1},
2693 End: hcl.Pos{Byte: 7, Line: 1, Column: 8},
2694 },
2695 },
2696 {
2697 Type: TokenEOF,
2698 Bytes: []byte{},
2699 Range: hcl.Range{
2700 Start: hcl.Pos{Byte: 7, Line: 1, Column: 8},
2701 End: hcl.Pos{Byte: 7, Line: 1, Column: 8},
2702 },
2703 },
2704 },
2705 },
2706 {
2707 "\nhello\n",
2708 []Token{
2709 {
2710 Type: TokenStringLit,
2711 Bytes: []byte("\n"),
2712 Range: hcl.Range{
2713 Start: hcl.Pos{Byte: 0, Line: 1, Column: 1},
2714 End: hcl.Pos{Byte: 1, Line: 2, Column: 1},
2715 },
2716 },
2717 {
2718 Type: TokenStringLit,
2719 Bytes: []byte("hello\n"),
2720 Range: hcl.Range{
2721 Start: hcl.Pos{Byte: 1, Line: 2, Column: 1},

Callers

nothing calls this directly

Calls 2

scanTokensFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected