MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / TestDeleteFromDescendants

Method TestDeleteFromDescendants

options/options_test.go:97–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95}
96
97func (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
120func (s *OptionsTestSuite) TestCopyValue() {
121 o := options.New()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
GetFunction · 0.92
AddChildMethod · 0.80
DeleteFromDescendantsMethod · 0.80
SetMethod · 0.45
HasMethod · 0.45

Tested by

no test coverage detected