(t *testing.T)
| 342 | } |
| 343 | |
| 344 | func TestRenderCreateTable_AllFeatures(t *testing.T) { |
| 345 | stmt := &ast.CreateTableStatement{ |
| 346 | Name: "t", |
| 347 | Temporary: true, |
| 348 | IfNotExists: true, |
| 349 | Columns: []ast.ColumnDef{ |
| 350 | {Name: "id", Type: "INT"}, |
| 351 | {Name: "name", Type: "TEXT"}, |
| 352 | }, |
| 353 | Constraints: []ast.TableConstraint{ |
| 354 | {Type: "PRIMARY KEY", Columns: []string{"id"}}, |
| 355 | }, |
| 356 | Inherits: []string{"parent"}, |
| 357 | PartitionBy: &ast.PartitionBy{Type: "HASH", Columns: []string{"id"}}, |
| 358 | Options: []ast.TableOption{{Name: "engine", Value: "InnoDB"}}, |
| 359 | } |
| 360 | |
| 361 | readable := fmtStmt(stmt, ast.ReadableStyle()) |
| 362 | for _, want := range []string{"CREATE TEMPORARY TABLE IF NOT EXISTS", "INHERITS", "PARTITION BY"} { |
| 363 | if !strings.Contains(readable, want) { |
| 364 | t.Errorf("missing %q in readable: %s", want, readable) |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | compact := fmtStmt(stmt, ast.CompactStyle()) |
| 369 | if strings.Contains(compact, "\n") { |
| 370 | t.Errorf("compact should be single line: %s", compact) |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | func TestRenderCreateTable_Nil(t *testing.T) { |
| 375 | var stmt *ast.CreateTableStatement |
nothing calls this directly
no test coverage detected