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

Function TestRenderSelect_Compact

pkg/formatter/render_test.go:39–63  ·  view source on GitHub ↗

─── SELECT ──────────────────────────────────────────────────────────────────

(t *testing.T)

Source from the content-addressed store, hash-verified

37// ─── SELECT ──────────────────────────────────────────────────────────────────
38
39func TestRenderSelect_Compact(t *testing.T) {
40 stmt := &ast.SelectStatement{
41 Columns: []ast.Expression{&ast.Identifier{Name: "a"}, &ast.Identifier{Name: "b"}},
42 From: []ast.TableReference{{Name: "users"}},
43 Where: &ast.BinaryExpression{
44 Left: &ast.Identifier{Name: "active"},
45 Operator: "=",
46 Right: &ast.LiteralValue{Value: "true"},
47 },
48 }
49
50 result := fmtStmt(stmt, ast.CompactStyle())
51 if strings.Contains(result, "\n") {
52 t.Errorf("CompactStyle should be single line, got: %s", result)
53 }
54 if !strings.Contains(result, "SELECT") {
55 t.Errorf("should contain SELECT, got: %s", result)
56 }
57 if !strings.Contains(result, "FROM users") {
58 t.Errorf("should contain FROM users, got: %s", result)
59 }
60 if !strings.Contains(result, "WHERE") {
61 t.Errorf("should contain WHERE, got: %s", result)
62 }
63}
64
65func TestRenderSelect_Readable(t *testing.T) {
66 stmt := &ast.SelectStatement{

Callers

nothing calls this directly

Calls 3

CompactStyleFunction · 0.92
fmtStmtFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected