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

Function TestRecursiveInclude

eval_test.go:842–855  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

840}
841
842func TestRecursiveInclude(t *testing.T) {
843 l := NewInMemLoader()
844 l.Set("recursive_incl_1", `{{ include "./recursive_incl_2" }}`)
845 l.Set("recursive_incl_2", `{{ include "./recursive_incl_1" }}`)
846 var set = NewSet(l, WithSafeWriter(nil))
847 tt, err := set.getTemplate("recursive_incl_1", true)
848 err = tt.Execute(io.Discard, nil, nil)
849 if err == nil {
850 t.Error("expected recursive include to fail with a runtime error, but got nil")
851 }
852 if !strings.Contains(err.Error(), "maximum 'include' depth") {
853 t.Errorf("expected runtime error to be about maximum include depth, but got %q", err.Error())
854 }
855}
856
857func BenchmarkSimpleAction(b *testing.B) {
858 t, _ := JetTestingSet.GetTemplate("actionNode_dummy")

Callers

nothing calls this directly

Calls 6

SetMethod · 0.95
NewInMemLoaderFunction · 0.85
NewSetFunction · 0.85
WithSafeWriterFunction · 0.85
getTemplateMethod · 0.80
ExecuteMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…