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

Function TestIdent

pkg/sql/ast/types_test.go:100–142  ·  view source on GitHub ↗

Test Ident

(t *testing.T)

Source from the content-addressed store, hash-verified

98
99// Test Ident
100func TestIdent(t *testing.T) {
101 tests := []struct {
102 name string
103 ident *Ident
104 wantString string
105 }{
106 {
107 name: "simple identifier",
108 ident: &Ident{Name: "user_id"},
109 wantString: "user_id",
110 },
111 {
112 name: "qualified identifier",
113 ident: &Ident{Name: "users.id"},
114 wantString: "users.id",
115 },
116 }
117
118 for _, tt := range tests {
119 t.Run(tt.name, func(t *testing.T) {
120 // Test String
121 if got := tt.ident.String(); got != tt.wantString {
122 t.Errorf("Ident.String() = %v, want %v", got, tt.wantString)
123 }
124
125 // Test TokenLiteral
126 if got := tt.ident.TokenLiteral(); got != tt.wantString {
127 t.Errorf("Ident.TokenLiteral() = %v, want %v", got, tt.wantString)
128 }
129
130 // Test Children (should be nil)
131 if children := tt.ident.Children(); children != nil {
132 t.Errorf("Ident.Children() = %v, want nil", children)
133 }
134
135 // Test expressionNode
136 tt.ident.expressionNode()
137
138 // Test interface implementation
139 var _ Expression = tt.ident
140 })
141 }
142}
143
144// Test CommentDef
145func TestCommentDef(t *testing.T) {

Callers

nothing calls this directly

Calls 6

RunMethod · 0.80
ErrorfMethod · 0.65
TokenLiteralMethod · 0.65
ChildrenMethod · 0.65
expressionNodeMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected