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

Function TestParser_DisplayTokens

cmd/gosqlx/cmd/parser_cmd_test.go:206–232  ·  view source on GitHub ↗

TestParser_DisplayTokens tests token display

(t *testing.T)

Source from the content-addressed store, hash-verified

204
205// TestParser_DisplayTokens tests token display
206func TestParser_DisplayTokens(t *testing.T) {
207 var outBuf, errBuf bytes.Buffer
208 parser := NewParser(&outBuf, &errBuf, CLIParserOptions{
209 Format: "table",
210 ShowTokens: true,
211 })
212
213 result, err := parser.Parse("SELECT * FROM users")
214 if err != nil {
215 t.Fatalf("Unexpected error: %v", err)
216 }
217
218 err = parser.Display(result)
219 if err != nil {
220 t.Fatalf("Failed to display tokens: %v", err)
221 }
222
223 output := outBuf.String()
224 if output == "" {
225 t.Error("Expected token output but got empty string")
226 }
227
228 // Check for token output format
229 if !strings.Contains(output, "Tokens") {
230 t.Error("Expected 'Tokens' in output")
231 }
232}
233
234// TestParser_DisplayTree tests tree visualization
235func TestParser_DisplayTree(t *testing.T) {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected