(t *testing.T)
| 291 | } |
| 292 | |
| 293 | func TestAddPackageArrayComments(t *testing.T) { |
| 294 | in, want := parseConfigTxtarTest(t, ` |
| 295 | -- in -- |
| 296 | { |
| 297 | "packages": [ |
| 298 | // Go package comment |
| 299 | "go", |
| 300 | |
| 301 | // Python package comment |
| 302 | "python@3.10" |
| 303 | ] |
| 304 | } |
| 305 | -- want -- |
| 306 | { |
| 307 | "packages": [ |
| 308 | // Go package comment |
| 309 | "go", |
| 310 | |
| 311 | // Python package comment |
| 312 | "python@3.10", |
| 313 | "hello@latest", |
| 314 | ], |
| 315 | }`) |
| 316 | |
| 317 | in.PackagesMutator.Add("hello@latest") |
| 318 | if diff := cmp.Diff(want, in.Bytes(), optParseHujson()); diff != "" { |
| 319 | t.Errorf("wrong parsed config json (-want +got):\n%s", diff) |
| 320 | } |
| 321 | if diff := cmp.Diff(want, in.Bytes()); diff != "" { |
| 322 | t.Errorf("wrong raw config hujson (-want +got):\n%s", diff) |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | func TestRemovePackageObject(t *testing.T) { |
| 327 | in, want := parseConfigTxtarTest(t, ` |
nothing calls this directly
no test coverage detected