MCPcopy Create free account
hub / github.com/bytebase/bytebase / runCompletionCases

Function runCompletionCases

backend/plugin/parser/redshift/completion_test.go:649–664  ·  view source on GitHub ↗
(t *testing.T, completionContext base.CompletionContext, tests []completionCase)

Source from the content-addressed store, hash-verified

647}
648
649func runCompletionCases(t *testing.T, completionContext base.CompletionContext, tests []completionCase) {
650 t.Helper()
651 for _, tc := range tests {
652 t.Run(tc.name, func(t *testing.T) {
653 statement, caretLine, caretOffset := catchCompletionCaret(t, tc.input)
654 candidates, err := base.Completion(context.Background(), storepb.Engine_REDSHIFT, completionContext, statement, caretLine, caretOffset)
655 require.NoError(t, err)
656 for _, want := range tc.want {
657 require.Truef(t, hasCompletionCandidate(candidates, want.text, want.typ), "missing candidate {%s, %s} in %v", want.text, want.typ, candidateSummary(candidates))
658 }
659 for _, text := range tc.absentText {
660 require.Falsef(t, hasCompletionCandidateText(candidates, text), "unexpected candidate %q in %v", text, candidateSummary(candidates))
661 }
662 })
663 }
664}
665
666func TestCompletionNilOrFailedMetadataDoesNotReturnObjects(t *testing.T) {
667 tests := []struct {

Calls 6

CompletionFunction · 0.92
catchCompletionCaretFunction · 0.85
hasCompletionCandidateFunction · 0.70
candidateSummaryFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected