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

Function TestMariaDB_CreateSequence_Basic

pkg/sql/parser/mariadb_test.go:15–34  ·  view source on GitHub ↗

── Task 7: SEQUENCE Tests ────────────────────────────────────────────────────

(t *testing.T)

Source from the content-addressed store, hash-verified

13// ── Task 7: SEQUENCE Tests ────────────────────────────────────────────────────
14
15func TestMariaDB_CreateSequence_Basic(t *testing.T) {
16 sql := "CREATE SEQUENCE seq_orders START WITH 1 INCREMENT BY 1"
17 tree, err := parser.ParseWithDialect(sql, keywords.DialectMariaDB)
18 if err != nil {
19 t.Fatalf("unexpected error: %v", err)
20 }
21 if len(tree.Statements) != 1 {
22 t.Fatalf("expected 1 statement, got %d", len(tree.Statements))
23 }
24 stmt, ok := tree.Statements[0].(*ast.CreateSequenceStatement)
25 if !ok {
26 t.Fatalf("expected CreateSequenceStatement, got %T", tree.Statements[0])
27 }
28 if stmt.Name.Name != "seq_orders" {
29 t.Errorf("expected name %q, got %q", "seq_orders", stmt.Name.Name)
30 }
31 if stmt.Options.StartWith == nil {
32 t.Error("expected StartWith to be set")
33 }
34}
35
36func TestMariaDB_CreateSequence_AllOptions(t *testing.T) {
37 sql := `CREATE SEQUENCE s START WITH 100 INCREMENT BY 5 MINVALUE 1 MAXVALUE 9999 CYCLE CACHE 20`

Callers

nothing calls this directly

Calls 4

ParseWithDialectFunction · 0.92
FatalfMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected