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

Function TestParseBytesWithTokens

pkg/sql/parser/validate_test.go:79–89  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestParseBytesWithTokens(t *testing.T) {
80 result, tokens, err := parser.ParseBytesWithTokens([]byte("SELECT 1"))
81 if err != nil {
82 t.Fatalf("ParseBytesWithTokens failed: %v", err)
83 }
84 defer ast.ReleaseAST(result)
85
86 if len(tokens) == 0 {
87 t.Fatal("expected tokens")
88 }
89}
90
91func BenchmarkValidate(b *testing.B) {
92 sql := "SELECT u.id, u.name, u.email FROM users u JOIN orders o ON u.id = o.user_id WHERE u.active = true AND o.total > 100 ORDER BY o.created_at DESC LIMIT 50"

Callers

nothing calls this directly

Calls 3

ParseBytesWithTokensFunction · 0.92
ReleaseASTFunction · 0.92
FatalfMethod · 0.65

Tested by

no test coverage detected