MCPcopy Index your code
hub / github.com/jetify-com/devbox / TestRemovePackageArray

Function TestRemovePackageArray

internal/devconfig/configfile/file_test.go:375–393  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

373}
374
375func TestRemovePackageArray(t *testing.T) {
376 in, want := parseConfigTxtarTest(t, `
377-- in --
378{
379 "packages": ["go@latest", "python@3.10"]
380}
381-- want --
382{
383 "packages": ["python@3.10"]
384}`)
385
386 in.PackagesMutator.Remove("go@latest")
387 if diff := cmp.Diff(want, in.Bytes(), optParseHujson()); diff != "" {
388 t.Errorf("wrong parsed config json (-want +got):\n%s", diff)
389 }
390 if diff := cmp.Diff(want, in.Bytes()); diff != "" {
391 t.Errorf("wrong raw config hujson (-want +got):\n%s", diff)
392 }
393}
394
395func TestRemovePackageLastElement(t *testing.T) {
396 in, want := parseConfigTxtarTest(t, `

Callers

nothing calls this directly

Calls 4

parseConfigTxtarTestFunction · 0.85
optParseHujsonFunction · 0.85
BytesMethod · 0.80
RemoveMethod · 0.45

Tested by

no test coverage detected