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

Method TestPropagate

options/options_test.go:72–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72func (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
97func (s *OptionsTestSuite) TestDeleteFromDescendants() {
98 o := options.New()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected