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

Function TestRenderInsert_Readable

pkg/formatter/render_test.go:166–185  ·  view source on GitHub ↗

─── INSERT ──────────────────────────────────────────────────────────────────

(t *testing.T)

Source from the content-addressed store, hash-verified

164// ─── INSERT ──────────────────────────────────────────────────────────────────
165
166func TestRenderInsert_Readable(t *testing.T) {
167 stmt := &ast.InsertStatement{
168 TableName: "users",
169 Columns: []ast.Expression{&ast.Identifier{Name: "name"}, &ast.Identifier{Name: "age"}},
170 Values: [][]ast.Expression{
171 {&ast.LiteralValue{Value: "'Alice'"}, &ast.LiteralValue{Value: "30"}},
172 },
173 }
174
175 result := fmtStmt(stmt, ast.ReadableStyle())
176 if !strings.Contains(result, "INSERT INTO") {
177 t.Errorf("should contain INSERT INTO, got: %s", result)
178 }
179 if !strings.Contains(result, "VALUES") {
180 t.Errorf("should contain VALUES, got: %s", result)
181 }
182 if !strings.HasSuffix(strings.TrimSpace(result), ";") {
183 t.Errorf("should end with semicolon, got: %s", result)
184 }
185}
186
187func TestRenderInsert_WithQuery(t *testing.T) {
188 stmt := &ast.InsertStatement{

Callers

nothing calls this directly

Calls 3

ReadableStyleFunction · 0.92
fmtStmtFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected