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

Function TestMapProcess_DefaultValue

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

Source from the content-addressed store, hash-verified

135}
136
137func TestMapProcess_DefaultValue(t *testing.T) {
138 cfg := Node{
139 Children: []Node{},
140 }
141
142 m := NewMap(nil, cfg)
143
144 foo := ""
145 m.Custom("foo", false, false, func() (interface{}, error) {
146 return "bar", nil
147 }, func(_ *Map, n Node) (interface{}, error) {
148 return n.Args[0], nil
149 }, &foo)
150
151 _, err := m.Process()
152 if err != nil {
153 t.Fatalf("Unexpected failure: %v", err)
154 }
155
156 if foo != "bar" {
157 t.Errorf("Incorrect value stored in variable, want 'bar', got '%s'", foo)
158 }
159}
160
161func TestMapProcess_InheritGlobal_DefaultValue(t *testing.T) {
162 cfg := Node{

Callers

nothing calls this directly

Calls 3

CustomMethod · 0.95
ProcessMethod · 0.95
NewMapFunction · 0.85

Tested by

no test coverage detected