mirror of
https://github.com/rclone/rclone.git
synced 2025-01-10 16:28:30 +01:00
configmap: add ClearSetters to get rid of all setters #5178
This commit is contained in:
parent
ddb7eb6e0a
commit
1a41c930f3
@ -60,6 +60,12 @@ func (c *Map) AddSetter(setter Setter) *Map {
|
||||
return c
|
||||
}
|
||||
|
||||
// ClearSetters removes all the setters set so far
|
||||
func (c *Map) ClearSetters() *Map {
|
||||
c.setters = nil
|
||||
return c
|
||||
}
|
||||
|
||||
// get gets an item with the key passed in and return the value from
|
||||
// the first getter. If the item is found then it returns true,
|
||||
// otherwise false.
|
||||
|
@ -88,6 +88,21 @@ func TestConfigMapSet(t *testing.T) {
|
||||
"config1": "beetroot",
|
||||
"config2": "potato",
|
||||
}, m2)
|
||||
|
||||
m.ClearSetters()
|
||||
|
||||
// Check that nothing gets set
|
||||
m.Set("config1", "BEETROOT")
|
||||
|
||||
assert.Equal(t, Simple{
|
||||
"config1": "beetroot",
|
||||
"config2": "potato",
|
||||
}, m1)
|
||||
assert.Equal(t, Simple{
|
||||
"config1": "beetroot",
|
||||
"config2": "potato",
|
||||
}, m2)
|
||||
|
||||
}
|
||||
|
||||
func TestConfigMapGetOverride(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user