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

Function TestMapProcess

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

Source from the content-addressed store, hash-verified

23)
24
25func TestMapProcess(t *testing.T) {
26 cfg := Node{
27 Children: []Node{
28 {
29 Name: "foo",
30 Args: []string{"bar"},
31 },
32 },
33 }
34
35 m := NewMap(nil, cfg)
36
37 foo := ""
38 m.Custom("foo", false, true, nil, func(_ *Map, n Node) (interface{}, error) {
39 return n.Args[0], nil
40 }, &foo)
41
42 _, err := m.Process()
43 if err != nil {
44 t.Fatalf("Unexpected failure: %v", err)
45 }
46
47 if foo != "bar" {
48 t.Errorf("Incorrect value stored in variable, want 'bar', got '%s'", foo)
49 }
50}
51
52func TestMapProcess_MissingRequired(t *testing.T) {
53 cfg := Node{

Callers

nothing calls this directly

Calls 3

CustomMethod · 0.95
ProcessMethod · 0.95
NewMapFunction · 0.85

Tested by

no test coverage detected