MCPcopy Index your code
hub / github.com/pocketbase/pocketbase / TestScanAll

Function TestScanAll

tools/tokenizer/tokenizer_test.go:92–270  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestScanAll(t *testing.T) {
93 scenarios := []struct {
94 name string
95 content string
96 separators []rune
97 keepSeparator bool
98 keepEmptyTokens bool
99 ignoreParenthesis bool
100 expectError bool
101 expectTokens []string
102 }{
103 {
104 name: "empty string",
105 content: "",
106 separators: DefaultSeparators,
107 keepSeparator: false,
108 keepEmptyTokens: false,
109 ignoreParenthesis: false,
110 expectError: false,
111 expectTokens: nil,
112 },
113 {
114 name: "unbalanced parenthesis",
115 content: `(a,b() c`,
116 separators: DefaultSeparators,
117 keepSeparator: false,
118 keepEmptyTokens: false,
119 ignoreParenthesis: false,
120 expectError: true,
121 expectTokens: []string{},
122 },
123 {
124 name: "unmatching quotes",
125 content: `'asd"`,
126 separators: DefaultSeparators,
127 keepSeparator: false,
128 keepEmptyTokens: false,
129 ignoreParenthesis: false,
130 expectError: true,
131 expectTokens: []string{},
132 },
133 {
134 name: "no separators",
135 content: `a, b, c, d, e 123, "abc"`,
136 separators: nil,
137 keepSeparator: false,
138 keepEmptyTokens: false,
139 ignoreParenthesis: false,
140 expectError: false,
141 expectTokens: []string{`a, b, c, d, e 123, "abc"`},
142 },
143 {
144 name: "default separators",
145 content: `a, b , c , d e , "a,b, c " , ,, , (123, 456)
146 `,
147 separators: DefaultSeparators,
148 keepSeparator: false,
149 keepEmptyTokens: false,

Callers

nothing calls this directly

Calls 7

NewFromStringFunction · 0.85
SeparatorsMethod · 0.80
KeepSeparatorMethod · 0.80
KeepEmptyTokensMethod · 0.80
IgnoreParenthesisMethod · 0.80
ScanAllMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…