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

Function TestAnalyzeNilAST

pkg/advisor/optimizer_test.go:897–910  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Nil AST / edge cases ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

895// ---------------------------------------------------------------------------
896
897func TestAnalyzeNilAST(t *testing.T) {
898 opt := New()
899
900 result := opt.Analyze(nil)
901 if result == nil {
902 t.Fatal("expected non-nil result for nil AST")
903 }
904 if len(result.Suggestions) != 0 {
905 t.Errorf("expected 0 suggestions for nil AST, got %d", len(result.Suggestions))
906 }
907 if result.Score != 100 {
908 t.Errorf("expected score 100 for nil AST, got %d", result.Score)
909 }
910}
911
912func TestNewWithCustomRules(t *testing.T) {
913 opt := NewWithRules(&SelectStarRule{})

Callers

nothing calls this directly

Calls 3

NewFunction · 0.70
AnalyzeMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected