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

Function TestExistsExpression

pkg/sql/ast/nodes_test.go:978–1014  ·  view source on GitHub ↗

Test ExistsExpression node

(t *testing.T)

Source from the content-addressed store, hash-verified

976
977// Test ExistsExpression node
978func TestExistsExpression(t *testing.T) {
979 tests := []struct {
980 name string
981 existsExpr *ExistsExpression
982 wantLiteral string
983 wantChildren int
984 }{
985 {
986 name: "EXISTS with subquery",
987 existsExpr: &ExistsExpression{
988 Subquery: &SelectStatement{},
989 },
990 wantLiteral: "EXISTS",
991 wantChildren: 1,
992 },
993 }
994
995 for _, tt := range tests {
996 tt := tt // G601: Create local copy to avoid memory aliasing
997 t.Run(tt.name, func(t *testing.T) {
998 // Test TokenLiteral
999 if got := tt.existsExpr.TokenLiteral(); got != tt.wantLiteral {
1000 t.Errorf("ExistsExpression.TokenLiteral() = %v, want %v", got, tt.wantLiteral)
1001 }
1002
1003 // Test Children
1004 children := tt.existsExpr.Children()
1005 if len(children) != tt.wantChildren {
1006 t.Errorf("ExistsExpression.Children() count = %d, want %d", len(children), tt.wantChildren)
1007 }
1008
1009 // Test that it implements Expression interface
1010 var _ Expression = tt.existsExpr
1011 tt.existsExpr.expressionNode()
1012 })
1013 }
1014}
1015
1016// Test InExpression node
1017func TestInExpression(t *testing.T) {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected