MCPcopy Create free account
hub / github.com/coder/coder / TestTranslateIndentLevel

Function TestTranslateIndentLevel

agent/agentfiles/files_indent_internal_test.go:201–298  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

199}
200
201func TestTranslateIndentLevel(t *testing.T) {
202 t.Parallel()
203
204 tests := []struct {
205 name string
206 rLead string
207 sLead string
208 cLead string
209 searchUnit string
210 fileUnit string
211 want string
212 wantOK bool
213 }{
214 {
215 // Caller sends a 4sp search; inserted line is 8sp
216 // (one level deeper). File uses tabs, matched at
217 // 1-tab depth. Expected: 2 tabs.
218 name: "PositiveDeltaWrap",
219 rLead: " ",
220 sLead: " ",
221 cLead: "\t",
222 searchUnit: " ",
223 fileUnit: "\t",
224 want: "\t\t",
225 wantOK: true,
226 },
227 {
228 // Inserted line at the same level as its reference.
229 name: "ZeroDeltaSameLevel",
230 rLead: " ",
231 sLead: " ",
232 cLead: "\t",
233 searchUnit: " ",
234 fileUnit: "\t",
235 want: "\t",
236 wantOK: true,
237 },
238 {
239 // Inserted line shallower than the reference's
240 // level by more than the file_base: target goes
241 // negative, helper bails.
242 name: "NegativeDeltaBelowFileBase",
243 rLead: "",
244 sLead: " ",
245 cLead: "\t",
246 searchUnit: " ",
247 fileUnit: "\t",
248 want: "",
249 wantOK: false,
250 },
251 {
252 // Malformed rLead (3 spaces under a 4sp unit).
253 name: "MalformedRLead",
254 rLead: " ",
255 sLead: " ",
256 cLead: "\t",
257 searchUnit: " ",
258 fileUnit: "\t",

Callers

nothing calls this directly

Calls 3

translateIndentLevelFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected