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

Function TestFormat

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

Source from the content-addressed store, hash-verified

14)
15
16func TestFormat(t *testing.T) {
17 tests := []struct {
18 input string
19 want string
20 }{
21 {
22 ``,
23 ``,
24 },
25 {
26 `a=1`,
27 `a = 1`,
28 },
29 {
30 `a=b.c`,
31 `a = b.c`,
32 },
33 {
34 `a=b[c]`,
35 `a = b[c]`,
36 },
37 {
38 `a=b()[c]`,
39 `a = b()[c]`,
40 },
41 {
42 `a=["hello"][0]`,
43 `a = ["hello"][0]`,
44 },
45 {
46 `( a+2 )`,
47 `(a + 2)`,
48 },
49 {
50 `( a*2 )`,
51 `(a * 2)`,
52 },
53 {
54 `( a+-2 )`,
55 `(a + -2)`,
56 },
57 {
58 `( a*-2 )`,
59 `(a * -2)`,
60 },
61 {
62 `(-2+1)`,
63 `(-2 + 1)`,
64 },
65 {
66 `foo(1, -2,a*b, b,c)`,
67 `foo(1, -2, a * b, b, c)`,
68 },
69 {
70 `foo(a,b...)`,
71 `foo(a, b...)`,
72 },
73 {

Callers

nothing calls this directly

Calls 4

lexConfigFunction · 0.85
formatFunction · 0.85
RunMethod · 0.80
BytesMethod · 0.45

Tested by

no test coverage detected