| 68 | } |
| 69 | |
| 70 | func TestAnalyzer_InvalidQuery(t *testing.T) { |
| 71 | db := config.Database{ |
| 72 | Managed: true, |
| 73 | } |
| 74 | a := New(db) |
| 75 | defer a.Close(context.Background()) |
| 76 | |
| 77 | ctx := context.Background() |
| 78 | |
| 79 | migrations := []string{ |
| 80 | `CREATE TABLE users (id INTEGER PRIMARY KEY)`, |
| 81 | } |
| 82 | |
| 83 | query := `SELECT * FROM nonexistent` |
| 84 | node := &ast.TODO{} |
| 85 | |
| 86 | _, err := a.Analyze(ctx, node, query, migrations, nil) |
| 87 | if err == nil { |
| 88 | t.Error("Expected error for invalid query, got nil") |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func TestNormalizeType(t *testing.T) { |
| 93 | tests := []struct { |