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

Function TestAddPackageObjectComment

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

Source from the content-addressed store, hash-verified

196}
197
198func TestAddPackageObjectComment(t *testing.T) {
199 in, want := parseConfigTxtarTest(t, `
200-- in --
201{
202 "packages": {
203 // Package comment
204 "go": "latest"
205 }
206}
207-- want --
208{
209 "packages": {
210 // Package comment
211 "go": "latest",
212 "python": "3.10",
213 },
214}`)
215
216 in.PackagesMutator.Add("python@3.10")
217 if diff := cmp.Diff(want, in.Bytes(), optParseHujson()); diff != "" {
218 t.Errorf("wrong parsed config json (-want +got):\n%s", diff)
219 }
220 if diff := cmp.Diff(want, in.Bytes()); diff != "" {
221 t.Errorf("wrong raw config hujson (-want +got):\n%s", diff)
222 }
223}
224
225func TestAddPackageEmptyArray(t *testing.T) {
226 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