| 68 | } |
| 69 | |
| 70 | func 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 | |
| 92 | func TestMapProcess_InheritGlobal_MissingRequired(t *testing.T) { |
| 93 | cfg := Node{ |