Helper function to tokenize SQL for tests. Returns []token.Token for compatibility with ParseContext (backward-compat shim).
(t *testing.T, sql string)
| 28 | // Helper function to tokenize SQL for tests. |
| 29 | // Returns []token.Token for compatibility with ParseContext (backward-compat shim). |
| 30 | func tokenizeSQL(t *testing.T, sql string) []token.Token { |
| 31 | t.Helper() |
| 32 | tkz := tokenizer.GetTokenizer() |
| 33 | defer tokenizer.PutTokenizer(tkz) |
| 34 | |
| 35 | spanTokens, err := tkz.Tokenize([]byte(sql)) |
| 36 | if err != nil { |
| 37 | t.Fatalf("Failed to tokenize SQL: %v", err) |
| 38 | } |
| 39 | |
| 40 | // Wrap models.TokenWithSpan → token.Token for the ParseContext shim. |
| 41 | result := make([]token.Token, len(spanTokens)) |
| 42 | for i, st := range spanTokens { |
| 43 | result[i] = token.Token{Type: st.Token.Type, Literal: st.Token.Value} |
| 44 | } |
| 45 | return result |
| 46 | } |
| 47 | |
| 48 | // TestParseContext_BasicSuccess verifies that ParseContext works for valid SQL |
| 49 | func TestParseContext_BasicSuccess(t *testing.T) { |
no test coverage detected