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

Function TestNewWithCustomRules

pkg/advisor/optimizer_test.go:912–925  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

910}
911
912func TestNewWithCustomRules(t *testing.T) {
913 opt := NewWithRules(&SelectStarRule{})
914 if len(opt.Rules()) != 1 {
915 t.Errorf("expected 1 rule, got %d", len(opt.Rules()))
916 }
917
918 result := mustAnalyze(t, opt, "SELECT * FROM users")
919 if !hasSuggestion(result, "OPT-001") {
920 t.Error("expected OPT-001 suggestion")
921 }
922 if hasSuggestion(result, "OPT-002") {
923 t.Error("OPT-002 should not be present with custom rules")
924 }
925}
926
927// ---------------------------------------------------------------------------
928// FormatResult

Callers

nothing calls this directly

Calls 6

NewWithRulesFunction · 0.85
mustAnalyzeFunction · 0.85
hasSuggestionFunction · 0.85
ErrorfMethod · 0.65
RulesMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected