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

Function TestTemplateInspectorRawFallbackError

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

Source from the content-addressed store, hash-verified

87}
88
89func TestTemplateInspectorRawFallbackError(t *testing.T) {
90 b := new(bytes.Buffer)
91 tmpl, err := templates.Parse("{{.Dns}}")
92 if err != nil {
93 t.Fatal(err)
94 }
95 i := NewTemplateInspector(b, tmpl)
96 err = i.Inspect(testElement{"0.0.0.0"}, []byte(`{"Foo": "0.0.0.0"}`))
97 if err == nil {
98 t.Fatal("Expected error got nil")
99 }
100
101 if !strings.HasPrefix(err.Error(), "template parsing error") {
102 t.Fatalf("Expected template error, got %v", err)
103 }
104}
105
106func TestTemplateInspectorMultiple(t *testing.T) {
107 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…