TestFormat_DropSequence verifies DROP SEQUENCE statements are formatted correctly.
(t *testing.T)
| 103 | |
| 104 | // TestFormat_DropSequence verifies DROP SEQUENCE statements are formatted correctly. |
| 105 | func TestFormat_DropSequence(t *testing.T) { |
| 106 | sql := "DROP SEQUENCE IF EXISTS user_id_seq" |
| 107 | tree, err := gosqlx.ParseWithDialect(sql, keywords.DialectMariaDB) |
| 108 | if err != nil { |
| 109 | t.Fatalf("Parse error: %v", err) |
| 110 | } |
| 111 | stmt, ok := tree.Statements[0].(*ast.DropSequenceStatement) |
| 112 | if !ok { |
| 113 | t.Fatalf("expected *ast.DropSequenceStatement, got %T", tree.Statements[0]) |
| 114 | } |
| 115 | opts := ast.FormatOptions{} |
| 116 | result := formatter.FormatStatement(stmt, opts) |
| 117 | upper := strings.ToUpper(result) |
| 118 | if !strings.Contains(upper, "DROP") { |
| 119 | t.Errorf("expected DROP in output, got: %q", result) |
| 120 | } |
| 121 | if !strings.Contains(upper, "SEQUENCE") { |
| 122 | t.Errorf("expected SEQUENCE in output, got: %q", result) |
| 123 | } |
| 124 | if !strings.Contains(upper, "IF EXISTS") { |
| 125 | t.Errorf("expected IF EXISTS in output, got: %q", result) |
| 126 | } |
| 127 | if !strings.Contains(result, "user_id_seq") { |
| 128 | t.Errorf("expected sequence name in output, got: %q", result) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | // TestFormat_ShowStatement verifies SHOW statements are formatted correctly. |
| 133 | func TestFormat_ShowStatement(t *testing.T) { |
nothing calls this directly
no test coverage detected