MCPcopy Create free account
hub / github.com/docker/cli / TestParseJSONFunctions

Function TestParseJSONFunctions

templates/templates_test.go:13–21  ·  view source on GitHub ↗

GitHub #32120

(t *testing.T)

Source from the content-addressed store, hash-verified

11
12// GitHub #32120
13func TestParseJSONFunctions(t *testing.T) {
14 tm, err := Parse(`{{json .Ports}}`)
15 assert.NilError(t, err)
16
17 var b bytes.Buffer
18 assert.NilError(t, tm.Execute(&b, map[string]string{"Ports": "0.0.0.0:2->8/udp"}))
19 want := "\"0.0.0.0:2->8/udp\""
20 assert.Check(t, is.Equal(want, b.String()))
21}
22
23func TestParseStringFunctions(t *testing.T) {
24 tm, err := Parse(`{{join (split . ":") "/"}}`)

Callers

nothing calls this directly

Calls 2

ParseFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…