MCPcopy
hub / github.com/sqlc-dev/sqlc / TestAnalyzer_InvalidQuery

Function TestAnalyzer_InvalidQuery

internal/engine/sqlite/analyzer/analyze_test.go:70–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestAnalyzer_InvalidQuery(t *testing.T) {
71 db := config.Database{
72 Managed: true,
73 }
74 a := New(db)
75 defer a.Close(context.Background())
76
77 ctx := context.Background()
78
79 migrations := []string{
80 `CREATE TABLE users (id INTEGER PRIMARY KEY)`,
81 }
82
83 query := `SELECT * FROM nonexistent`
84 node := &ast.TODO{}
85
86 _, err := a.Analyze(ctx, node, query, migrations, nil)
87 if err == nil {
88 t.Error("Expected error for invalid query, got nil")
89 }
90}
91
92func TestNormalizeType(t *testing.T) {
93 tests := []struct {

Callers

nothing calls this directly

Calls 4

NewFunction · 0.70
CloseMethod · 0.65
AnalyzeMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected