| 73 | } |
| 74 | |
| 75 | func TestTruncateStatement_SQL(t *testing.T) { |
| 76 | stmt := &TruncateStatement{Tables: []string{"users"}, RestartIdentity: true, CascadeType: "CASCADE"} |
| 77 | sql := stmt.SQL() |
| 78 | if !strings.Contains(sql, "TRUNCATE TABLE users") || !strings.Contains(sql, "RESTART IDENTITY") { |
| 79 | t.Errorf("got: %s", sql) |
| 80 | } |
| 81 | |
| 82 | stmt2 := &TruncateStatement{Tables: []string{"t"}, ContinueIdentity: true} |
| 83 | sql2 := stmt2.SQL() |
| 84 | if !strings.Contains(sql2, "CONTINUE IDENTITY") { |
| 85 | t.Errorf("got: %s", sql2) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | func TestWithClause_SQL(t *testing.T) { |
| 90 | w := &WithClause{ |