(t *testing.T, completionContext base.CompletionContext, tests []completionCase)
| 647 | } |
| 648 | |
| 649 | func 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 | |
| 666 | func TestCompletionNilOrFailedMetadataDoesNotReturnObjects(t *testing.T) { |
| 667 | tests := []struct { |
no test coverage detected