(t *testing.T)
| 199 | } |
| 200 | |
| 201 | func 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", |
nothing calls this directly
no test coverage detected