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

Function TestQuery

pkg/sql/ast/types_test.go:69–97  ·  view source on GitHub ↗

Test Query

(t *testing.T)

Source from the content-addressed store, hash-verified

67
68// Test Query
69func TestQuery(t *testing.T) {
70 tests := []struct {
71 name string
72 query *Query
73 wantLiteral string
74 }{
75 {
76 name: "simple query",
77 query: &Query{
78 Text: "SELECT * FROM users",
79 },
80 wantLiteral: "QUERY",
81 },
82 }
83
84 for _, tt := range tests {
85 t.Run(tt.name, func(t *testing.T) {
86 // Test TokenLiteral
87 if got := tt.query.TokenLiteral(); got != tt.wantLiteral {
88 t.Errorf("Query.TokenLiteral() = %v, want %v", got, tt.wantLiteral)
89 }
90
91 // Test Children (should be nil)
92 if children := tt.query.Children(); children != nil {
93 t.Errorf("Query.Children() = %v, want nil", children)
94 }
95 })
96 }
97}
98
99// Test Ident
100func TestIdent(t *testing.T) {

Callers

nothing calls this directly

Calls 4

RunMethod · 0.80
TokenLiteralMethod · 0.65
ErrorfMethod · 0.65
ChildrenMethod · 0.65

Tested by

no test coverage detected