MCPcopy Index your code
hub / github.com/docker/cli / TestMarshallConfig

Function TestMarshallConfig

cli/compose/loader/types_test.go:14–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestMarshallConfig(t *testing.T) {
15 workingDir := "/foo"
16 homeDir := "/bar"
17 cfg := fullExampleConfig(workingDir, homeDir)
18
19 var buf bytes.Buffer
20 enc := yaml.NewEncoder(&buf)
21 enc.SetIndent(2)
22 err := enc.Encode(cfg)
23 assert.NilError(t, err)
24 actual := buf.String()
25 golden.Assert(t, actual, "full-example.yaml.golden")
26
27 // Make sure the expected can be parsed.
28 yamlData, err := os.ReadFile("testdata/full-example.yaml.golden")
29 assert.NilError(t, err)
30 dict, err := ParseYAML(yamlData)
31 assert.NilError(t, err)
32 _, err = Load(buildConfigDetails(dict, map[string]string{}))
33 assert.NilError(t, err)
34}
35
36func TestJSONMarshallConfig(t *testing.T) {
37 workingDir := "/foo"

Callers

nothing calls this directly

Calls 5

fullExampleConfigFunction · 0.85
ParseYAMLFunction · 0.85
buildConfigDetailsFunction · 0.85
LoadFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…