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

Function TestTemplateInspectorTemplateError

cli/command/inspect/inspector_test.go:52–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestTemplateInspectorTemplateError(t *testing.T) {
53 b := new(bytes.Buffer)
54 tmpl, err := templates.Parse("{{.Foo}}")
55 if err != nil {
56 t.Fatal(err)
57 }
58 i := NewTemplateInspector(b, tmpl)
59
60 err = i.Inspect(testElement{"0.0.0.0"}, nil)
61 if err == nil {
62 t.Fatal("Expected error got nil")
63 }
64
65 if !strings.HasPrefix(err.Error(), "template parsing error") {
66 t.Fatalf("Expected template error, got %v", err)
67 }
68}
69
70func TestTemplateInspectorRawFallback(t *testing.T) {
71 b := new(bytes.Buffer)

Callers

nothing calls this directly

Calls 3

InspectMethod · 0.95
NewTemplateInspectorFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…