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

Function TestParse

hclwrite/parser_test.go:17–1229  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestParse(t *testing.T) {
18 tests := []struct {
19 src string
20 want TestTreeNode
21 }{
22 {
23 "",
24 TestTreeNode{
25 Type: "Body",
26 },
27 },
28 {
29 "a = 1\n",
30 TestTreeNode{
31 Type: "Body",
32 Children: []TestTreeNode{
33 {
34 Type: "Attribute",
35 Children: []TestTreeNode{
36 {
37 Type: "comments",
38 },
39 {
40 Type: "identifier",
41 Val: "a",
42 },
43 {
44 Type: "Tokens",
45 Val: " =",
46 },
47 {
48 Type: "Expression",
49 Children: []TestTreeNode{
50 {
51 Type: "Tokens",
52 Val: " 1",
53 },
54 },
55 },
56 {
57 Type: "comments",
58 },
59 {
60 Type: "Tokens",
61 Val: "\n",
62 },
63 },
64 },
65 },
66 },
67 },
68 {
69 "# aye aye aye\na = 1\n",
70 TestTreeNode{
71 Type: "Body",
72 Children: []TestTreeNode{
73 {
74 Type: "Attribute",

Callers

nothing calls this directly

Calls 5

parseFunction · 0.85
makeTestTreeFunction · 0.85
RunMethod · 0.80
EqualMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected