MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestFormat_DropSequence

Function TestFormat_DropSequence

pkg/formatter/render_ddl_test.go:105–130  ·  view source on GitHub ↗

TestFormat_DropSequence verifies DROP SEQUENCE statements are formatted correctly.

(t *testing.T)

Source from the content-addressed store, hash-verified

103
104// TestFormat_DropSequence verifies DROP SEQUENCE statements are formatted correctly.
105func 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.
133func TestFormat_ShowStatement(t *testing.T) {

Callers

nothing calls this directly

Calls 4

ParseWithDialectFunction · 0.92
FormatStatementFunction · 0.92
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected