─── roundtrip ───────────────────────────────────────────────────────────────
(t *testing.T)
| 1098 | // ─── roundtrip ─────────────────────────────────────────────────────────────── |
| 1099 | |
| 1100 | func 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 | } |
nothing calls this directly
no test coverage detected