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

Function TestRenderRoundtrip_CompactMatchesSQL

pkg/formatter/render_test.go:1100–1116  ·  view source on GitHub ↗

─── roundtrip ───────────────────────────────────────────────────────────────

(t *testing.T)

Source from the content-addressed store, hash-verified

1098// ─── roundtrip ───────────────────────────────────────────────────────────────
1099
1100func TestRenderRoundtrip_CompactMatchesSQL(t *testing.T) {
1101 stmt := &ast.SelectStatement{
1102 Columns: []ast.Expression{&ast.Identifier{Name: "id"}, &ast.Identifier{Name: "name"}},
1103 From: []ast.TableReference{{Name: "users"}},
1104 Where: &ast.BinaryExpression{
1105 Left: &ast.Identifier{Name: "active"},
1106 Operator: "=",
1107 Right: &ast.LiteralValue{Value: "true"},
1108 },
1109 }
1110
1111 compact := fmtStmt(stmt, ast.CompactStyle())
1112 sqlStr := stmt.SQL()
1113 if compact != sqlStr {
1114 t.Errorf("CompactStyle should match SQL() output\nCompact: %s\nSQL(): %s", compact, sqlStr)
1115 }
1116}

Callers

nothing calls this directly

Calls 4

SQLMethod · 0.95
CompactStyleFunction · 0.92
fmtStmtFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected