| 95 | } |
| 96 | |
| 97 | func (s *OptionsTestSuite) TestDeleteFromDescendants() { |
| 98 | o := options.New() |
| 99 | o.Set("key1", "value1") |
| 100 | |
| 101 | child := o.AddChild() |
| 102 | child.Set("key1", "child_value1") |
| 103 | child.Set("key2", 200) |
| 104 | |
| 105 | grandChild := child.AddChild() |
| 106 | grandChild.Set("key1", "grandchild_value1") |
| 107 | grandChild.Set("key2", 300) |
| 108 | |
| 109 | o.DeleteFromDescendants("key1") |
| 110 | |
| 111 | s.Require().Equal("value1", options.Get(o, "key1", "")) |
| 112 | |
| 113 | s.Require().False(child.Has("key1")) |
| 114 | s.Require().Equal(200, options.Get(child, "key2", 0)) |
| 115 | |
| 116 | s.Require().False(grandChild.Has("key1")) |
| 117 | s.Require().Equal(300, options.Get(grandChild, "key2", 0)) |
| 118 | } |
| 119 | |
| 120 | func (s *OptionsTestSuite) TestCopyValue() { |
| 121 | o := options.New() |