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

Function TestRenderDelete_AllClauses

pkg/formatter/render_test.go:298–315  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

296}
297
298func TestRenderDelete_AllClauses(t *testing.T) {
299 stmt := &ast.DeleteStatement{
300 With: &ast.WithClause{CTEs: []*ast.CommonTableExpr{
301 {Name: "c", Statement: &ast.SelectStatement{Columns: []ast.Expression{&ast.Identifier{Name: "x"}}}},
302 }},
303 TableName: "t",
304 Alias: "tt",
305 Using: []ast.TableReference{{Name: "other"}},
306 Where: &ast.Identifier{Name: "true"},
307 Returning: []ast.Expression{&ast.Identifier{Name: "id"}},
308 }
309 result := fmtStmt(stmt, ast.ReadableStyle())
310 for _, want := range []string{"WITH", "DELETE FROM t tt", "USING", "WHERE", "RETURNING"} {
311 if !strings.Contains(result, want) {
312 t.Errorf("missing %q in: %s", want, result)
313 }
314 }
315}
316
317func TestRenderDelete_Nil(t *testing.T) {
318 var stmt *ast.DeleteStatement

Callers

nothing calls this directly

Calls 3

ReadableStyleFunction · 0.92
fmtStmtFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected