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

Function TestSuggestKeyword

pkg/errors/hints_test.go:22–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20)
21
22func TestSuggestKeyword(t *testing.T) {
23 tests := []struct {
24 name string
25 input string
26 want string
27 }{
28 {
29 name: "exact match",
30 input: "SELECT",
31 want: "SELECT",
32 },
33 {
34 name: "single character typo",
35 input: "SELCT",
36 want: "SELECT",
37 },
38 {
39 name: "transposed characters",
40 input: "FORM",
41 want: "FROM",
42 },
43 {
44 name: "case insensitive",
45 input: "form",
46 want: "FROM",
47 },
48 {
49 name: "multiple typos",
50 input: "SLECT",
51 want: "SELECT",
52 },
53 {
54 name: "common typo - WAHER",
55 input: "WAHER",
56 want: "WHERE",
57 },
58 {
59 name: "common typo - JION",
60 input: "JION",
61 want: "JOIN",
62 },
63 {
64 name: "common typo - UPDTE",
65 input: "UPDTE",
66 want: "UPDATE",
67 },
68 {
69 name: "completely unrelated word",
70 input: "SOMETHING",
71 want: "", // Should not suggest anything
72 },
73 {
74 name: "empty string",
75 input: "",
76 want: "",
77 },
78 }
79

Callers

nothing calls this directly

Calls 3

SuggestKeywordFunction · 0.85
RunMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected