MCPcopy Create free account
hub / github.com/jetify-com/devbox / TestAddPackageArrayComments

Function TestAddPackageArrayComments

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

Source from the content-addressed store, hash-verified

291}
292
293func 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
326func TestRemovePackageObject(t *testing.T) {
327 in, want := parseConfigTxtarTest(t, `

Callers

nothing calls this directly

Calls 4

parseConfigTxtarTestFunction · 0.85
optParseHujsonFunction · 0.85
BytesMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected