── Task 7: SEQUENCE Tests ────────────────────────────────────────────────────
(t *testing.T)
| 13 | // ── Task 7: SEQUENCE Tests ──────────────────────────────────────────────────── |
| 14 | |
| 15 | func 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 | |
| 36 | func TestMariaDB_CreateSequence_AllOptions(t *testing.T) { |
| 37 | sql := `CREATE SEQUENCE s START WITH 100 INCREMENT BY 5 MINVALUE 1 MAXVALUE 9999 CYCLE CACHE 20` |
nothing calls this directly
no test coverage detected