MCPcopy Index your code
hub / github.com/foxcpp/maddy / TestMapProcess_InheritGlobal_Override

Function TestMapProcess_InheritGlobal_Override

framework/config/map_test.go:110–135  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestMapProcess_InheritGlobal_Override(t *testing.T) {
111 cfg := Node{
112 Children: []Node{
113 {
114 Name: "foo",
115 Args: []string{"bar"},
116 },
117 },
118 }
119
120 m := NewMap(map[string]interface{}{}, cfg)
121
122 foo := ""
123 m.Custom("foo", false, true, nil, func(_ *Map, n Node) (interface{}, error) {
124 return n.Args[0], nil
125 }, &foo)
126
127 _, err := m.Process()
128 if err != nil {
129 t.Fatalf("Unexpected failure: %v", err)
130 }
131
132 if foo != "bar" {
133 t.Errorf("Incorrect value stored in variable, want 'bar', got '%s'", foo)
134 }
135}
136
137func TestMapProcess_DefaultValue(t *testing.T) {
138 cfg := Node{

Callers

nothing calls this directly

Calls 3

CustomMethod · 0.95
ProcessMethod · 0.95
NewMapFunction · 0.85

Tested by

no test coverage detected