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

Method TestCopyValue

options/options_test.go:120–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118}
119
120func (s *OptionsTestSuite) TestCopyValue() {
121 o := options.New()
122 o.Set("key1", 100)
123 o.Set("key2", 200)
124 o.Set("key3", 200)
125
126 // Existing to existing
127 o.CopyValue("key1", "key2")
128 s.Require().Equal(100, options.Get(o, "key2", 0))
129
130 // Existing to new
131 o.CopyValue("key1", "key4")
132 s.Require().Equal(100, options.Get(o, "key4", 0))
133
134 // Non-existing to new
135 o.CopyValue("non_existing_key", "key5")
136 s.Require().False(o.Has("key5"))
137
138 // Non-existing to existing
139 o.CopyValue("another_non_existing_key", "key3")
140 s.Require().Equal(200, options.Get(o, "key3", 0))
141}
142
143func (s *OptionsTestSuite) TestGetInt() {
144 o := options.New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
GetFunction · 0.92
CopyValueMethod · 0.80
SetMethod · 0.45
HasMethod · 0.45

Tested by

no test coverage detected