(t *testing.T)
| 108 | } |
| 109 | |
| 110 | func TestPrint_ConstantNode(t *testing.T) { |
| 111 | tests := []struct { |
| 112 | input any |
| 113 | want string |
| 114 | }{ |
| 115 | {nil, `nil`}, |
| 116 | {true, `true`}, |
| 117 | {false, `false`}, |
| 118 | {1, `1`}, |
| 119 | {1.1, `1.1`}, |
| 120 | {"a", `"a"`}, |
| 121 | {[]int{1, 2, 3}, `[1,2,3]`}, |
| 122 | {map[string]int{"a": 1}, `{"a":1}`}, |
| 123 | } |
| 124 | |
| 125 | for _, tt := range tests { |
| 126 | t.Run(tt.want, func(t *testing.T) { |
| 127 | node := &ast.ConstantNode{ |
| 128 | Value: tt.input, |
| 129 | } |
| 130 | require.Equal(t, tt.want, node.String()) |
| 131 | }) |
| 132 | } |
| 133 | } |