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

Function TestSetOperation

pkg/sql/ast/nodes_test.go:147–219  ·  view source on GitHub ↗

Test SetOperation node

(t *testing.T)

Source from the content-addressed store, hash-verified

145
146// Test SetOperation node
147func TestSetOperation(t *testing.T) {
148 tests := []struct {
149 name string
150 setOp *SetOperation
151 wantLiteral string
152 wantChildren int
153 }{
154 {
155 name: "UNION",
156 setOp: &SetOperation{
157 Left: &SelectStatement{},
158 Operator: "UNION",
159 Right: &SelectStatement{},
160 All: false,
161 },
162 wantLiteral: "UNION",
163 wantChildren: 2,
164 },
165 {
166 name: "UNION ALL",
167 setOp: &SetOperation{
168 Left: &SelectStatement{},
169 Operator: "UNION",
170 Right: &SelectStatement{},
171 All: true,
172 },
173 wantLiteral: "UNION",
174 wantChildren: 2,
175 },
176 {
177 name: "EXCEPT",
178 setOp: &SetOperation{
179 Left: &SelectStatement{},
180 Operator: "EXCEPT",
181 Right: &SelectStatement{},
182 All: false,
183 },
184 wantLiteral: "EXCEPT",
185 wantChildren: 2,
186 },
187 {
188 name: "INTERSECT",
189 setOp: &SetOperation{
190 Left: &SelectStatement{},
191 Operator: "INTERSECT",
192 Right: &SelectStatement{},
193 All: false,
194 },
195 wantLiteral: "INTERSECT",
196 wantChildren: 2,
197 },
198 }
199
200 for _, tt := range tests {
201 tt := tt // G601: Create local copy to avoid memory aliasing
202 t.Run(tt.name, func(t *testing.T) {
203 // Test TokenLiteral
204 if got := tt.setOp.TokenLiteral(); got != tt.wantLiteral {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected