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

Function TestMapProcess_InheritGlobal

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

Source from the content-addressed store, hash-verified

68}
69
70func TestMapProcess_InheritGlobal(t *testing.T) {
71 cfg := Node{
72 Children: []Node{},
73 }
74
75 m := NewMap(map[string]interface{}{"foo": "bar"}, cfg)
76
77 foo := ""
78 m.Custom("foo", true, true, nil, func(_ *Map, n Node) (interface{}, error) {
79 return n.Args[0], nil
80 }, &foo)
81
82 _, err := m.Process()
83 if err != nil {
84 t.Fatalf("Unexpected failure: %v", err)
85 }
86
87 if foo != "bar" {
88 t.Errorf("Incorrect value stored in variable, want 'bar', got '%s'", foo)
89 }
90}
91
92func TestMapProcess_InheritGlobal_MissingRequired(t *testing.T) {
93 cfg := Node{

Callers

nothing calls this directly

Calls 3

CustomMethod · 0.95
ProcessMethod · 0.95
NewMapFunction · 0.85

Tested by

no test coverage detected