| 70 | } |
| 71 | |
| 72 | func (s *OptionsTestSuite) TestPropagate() { |
| 73 | o := options.New() |
| 74 | o.Set("key1", "value1") |
| 75 | o.Set("key2", 100) |
| 76 | o.Set("key3", false) |
| 77 | |
| 78 | child := o.AddChild() |
| 79 | child.Set("key1", "child_value1") |
| 80 | child.Set("key3", true) |
| 81 | |
| 82 | grandChild := child.AddChild() |
| 83 | grandChild.Set("key2", 300) |
| 84 | |
| 85 | o.Propagate("key1") |
| 86 | o.Propagate("key2") |
| 87 | |
| 88 | s.Require().Equal("value1", options.Get(child, "key1", "")) |
| 89 | s.Require().Equal(100, options.Get(child, "key2", 0)) |
| 90 | s.Require().True(options.Get(child, "key3", false)) |
| 91 | |
| 92 | s.Require().Equal("value1", options.Get(grandChild, "key1", "")) |
| 93 | s.Require().Equal(100, options.Get(grandChild, "key2", 0)) |
| 94 | s.Require().False(grandChild.Has("key3")) |
| 95 | } |
| 96 | |
| 97 | func (s *OptionsTestSuite) TestDeleteFromDescendants() { |
| 98 | o := options.New() |