MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestParser_DisplayAST_YAML

Function TestParser_DisplayAST_YAML

cmd/gosqlx/cmd/parser_cmd_test.go:146–167  ·  view source on GitHub ↗

TestParser_DisplayAST_YAML tests YAML output format

(t *testing.T)

Source from the content-addressed store, hash-verified

144
145// TestParser_DisplayAST_YAML tests YAML output format
146func TestParser_DisplayAST_YAML(t *testing.T) {
147 var outBuf, errBuf bytes.Buffer
148 parser := NewParser(&outBuf, &errBuf, CLIParserOptions{
149 Format: "yaml",
150 })
151
152 result, err := parser.Parse("SELECT * FROM users")
153 if err != nil {
154 t.Fatalf("Unexpected error: %v", err)
155 }
156 defer ast.ReleaseAST(result.AST)
157
158 err = parser.Display(result)
159 if err != nil {
160 t.Fatalf("Failed to display: %v", err)
161 }
162
163 output := outBuf.String()
164 if output == "" {
165 t.Error("Expected YAML output but got empty string")
166 }
167}
168
169// TestParser_DisplayAST_Table tests table output format
170func TestParser_DisplayAST_Table(t *testing.T) {

Callers

nothing calls this directly

Calls 7

ParseMethod · 0.95
DisplayMethod · 0.95
ReleaseASTFunction · 0.92
NewParserFunction · 0.70
FatalfMethod · 0.65
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected