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

Function TestRenderExists

pkg/formatter/render_test.go:987–999  ·  view source on GitHub ↗

─── EXISTS expression ────────────────────────────────────────────────────────

(t *testing.T)

Source from the content-addressed store, hash-verified

985// ─── EXISTS expression ────────────────────────────────────────────────────────
986
987func TestRenderExists(t *testing.T) {
988 expr := &ast.ExistsExpression{
989 Subquery: &ast.SelectStatement{
990 Columns: []ast.Expression{&ast.LiteralValue{Value: "1"}},
991 From: []ast.TableReference{{Name: "users"}},
992 Where: &ast.BinaryExpression{Left: &ast.Identifier{Name: "active"}, Operator: "=", Right: &ast.LiteralValue{Value: "true"}},
993 },
994 }
995 result := fmtExpr(expr, ast.ReadableStyle())
996 if !strings.Contains(result, "EXISTS") || !strings.Contains(result, "SELECT") {
997 t.Errorf("expected EXISTS (SELECT ...) in: %s", result)
998 }
999}
1000
1001func TestRenderExists_Nil(t *testing.T) {
1002 var expr *ast.ExistsExpression

Callers

nothing calls this directly

Calls 3

ReadableStyleFunction · 0.92
fmtExprFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected