Test ExistsExpression node
(t *testing.T)
| 976 | |
| 977 | // Test ExistsExpression node |
| 978 | func 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 |
| 1017 | func TestInExpression(t *testing.T) { |
nothing calls this directly
no test coverage detected