MCPcopy Create free account
hub / github.com/CloudyKit/jet / TestExecuteConcurrency

Function TestExecuteConcurrency

exec_test.go:9–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestExecuteConcurrency(t *testing.T) {
10 l := NewInMemLoader()
11 l.Set("foo", "{{if true}}Hi {{ .Name }}!{{end}}")
12
13 set := NewSet(l)
14
15 tpl, err := set.GetTemplate("foo")
16 if err != nil {
17 t.Errorf("getting template from set: %v", err)
18 }
19
20 for i := 0; i < 100; i++ {
21 t.Run(fmt.Sprintf("CC_%d", i), func(t *testing.T) {
22 t.Parallel()
23
24 err := tpl.Execute(ioutil.Discard, nil, struct{ Name string }{Name: "John"})
25 if err != nil {
26 t.Errorf("executing template: %v", err)
27 }
28 })
29 }
30}

Callers

nothing calls this directly

Calls 5

SetMethod · 0.95
GetTemplateMethod · 0.95
NewInMemLoaderFunction · 0.85
NewSetFunction · 0.85
ExecuteMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…