(t *testing.T)
| 21 | ) |
| 22 | |
| 23 | func TestAddJoin(t *testing.T) { |
| 24 | stmt := mustParse(t, "SELECT * FROM users") |
| 25 | cond := &ast.BinaryExpression{ |
| 26 | Left: &ast.Identifier{Name: "id", Table: "orders"}, |
| 27 | Operator: "=", |
| 28 | Right: &ast.Identifier{Name: "user_id", Table: "users"}, |
| 29 | } |
| 30 | err := Apply(stmt, AddJoin("LEFT", "orders", cond)) |
| 31 | if err != nil { |
| 32 | t.Fatal(err) |
| 33 | } |
| 34 | out := format(stmt) |
| 35 | assertContains(t, out, "LEFT JOIN") |
| 36 | assertContains(t, out, "orders") |
| 37 | } |
| 38 | |
| 39 | func TestRemoveJoin(t *testing.T) { |
| 40 | stmt := mustParse(t, "SELECT * FROM users INNER JOIN orders ON orders.user_id = users.id") |
nothing calls this directly
no test coverage detected