MCPcopy
hub / github.com/urfave/cli / TestMapValueSource

Function TestMapValueSource

value_source_test.go:193–336  ·  value_source_test.go::TestMapValueSource
(t *testing.T)

Source from the content-addressed store, hash-verified

191func (svs *staticValueSource) Lookup() (string, bool) { return svs.v, true }
192
193func TestMapValueSource(t *testing.T) {
194 tests := []struct {
195 name string
196 m map[any]any
197 key string
198 val string
199 found bool
200 }{
201 {
202 name: "No map no key",
203 },
204 {
205 name: "No map with key",
206 key: "foo",
207 },
208 {
209 name: "Empty map no key",
210 m: map[any]any{},
211 },
212 {
213 name: "Empty map with key",
214 key: "foo",
215 m: map[any]any{},
216 },
217 {
218 name: "Level 1 no key",
219 key: ".foob",
220 m: map[any]any{
221 "foo": 10,
222 },
223 },
224 {
225 name: "Level 1",
226 key: "foobar",
227 m: map[any]any{
228 "foobar": 10,
229 },
230 val: "10",
231 found: true,
232 },
233 {
234 name: "Level 2",
235 key: "foo.bar",
236 m: map[any]any{
237 "foo": map[any]any{
238 "bar": 10,
239 },
240 },
241 val: "10",
242 found: true,
243 },
244 {
245 name: "Level 2 invalid key",
246 key: "foo.bar1",
247 m: map[any]any{
248 "foo": map[any]any{
249 "bar": "10",
250 },

Callers

nothing calls this directly

Calls 4

NewMapSourceFunction · 0.85
NewMapValueSourceFunction · 0.85
LookupMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected