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

Function catchCompletionCaret

backend/plugin/parser/redshift/completion_test.go:712–733  ·  view source on GitHub ↗
(t *testing.T, input string)

Source from the content-addressed store, hash-verified

710func (assertAnError) Error() string { return "assert an error" }
711
712func catchCompletionCaret(t *testing.T, input string) (string, int, int) {
713 t.Helper()
714 line := 1
715 offset := 0
716 for i, r := range input {
717 if r == '|' {
718 return input[:i] + input[i+1:], line, offset
719 }
720 if r == '\n' {
721 line++
722 offset = 0
723 continue
724 }
725 if r <= 0xFFFF {
726 offset++
727 } else {
728 offset += 2
729 }
730 }
731 t.Fatalf("missing caret marker in %q", input)
732 return "", 0, 0
733}
734
735func hasCompletionCandidateText(candidates []base.Candidate, text string) bool {
736 for _, candidate := range candidates {

Calls 1

FatalfMethod · 0.80

Tested by

no test coverage detected