MCPcopy
hub / github.com/kubernetes/client-go / testFailJSONPath

Function testFailJSONPath

util/jsonpath/jsonpath_test.go:90–109  ·  view source on GitHub ↗
(tests []jsonpathTest, t *testing.T)

Source from the content-addressed store, hash-verified

88}
89
90func testFailJSONPath(tests []jsonpathTest, t *testing.T) {
91 for _, test := range tests {
92 j := New(test.name)
93 err := j.Parse(test.template)
94 if err != nil {
95 t.Errorf("in %s, parse %s error %v", test.name, test.template, err)
96 }
97 buf := new(bytes.Buffer)
98 err = j.Execute(buf, test.input)
99 var out string
100 if err == nil {
101 out = "nil"
102 } else {
103 out = err.Error()
104 }
105 if out != test.expect {
106 t.Errorf("in %s, expect to get error %q, got %q", test.name, test.expect, out)
107 }
108 }
109}
110
111type book struct {
112 Category string

Callers 1

TestStructInputFunction · 0.85

Calls 5

ExecuteMethod · 0.80
NewFunction · 0.70
ErrorfMethod · 0.65
ErrorMethod · 0.65
ParseMethod · 0.45

Tested by

no test coverage detected