mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
Add map support to scratch
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
8d28686edc
commit
4bed69629e
@@ -47,3 +47,21 @@ func TestScratchGet(t *testing.T) {
|
||||
t.Errorf("Should not return anything, but got %v", nothing)
|
||||
}
|
||||
}
|
||||
|
||||
func TestScratchSetInMap(t *testing.T) {
|
||||
scratch := newScratch()
|
||||
scratch.SetInMap("key", "lux", "Lux")
|
||||
scratch.SetInMap("key", "abc", "Abc")
|
||||
scratch.SetInMap("key", "zyx", "Zyx")
|
||||
scratch.SetInMap("key", "abc", "Abc (updated)")
|
||||
scratch.SetInMap("key", "def", "Def")
|
||||
assert.Equal(t, []interface{}{0: "Abc (updated)", 1: "Def", 2: "Lux", 3: "Zyx"}, scratch.GetSortedMapValues("key"))
|
||||
}
|
||||
|
||||
func TestScratchGetSortedMapValues(t *testing.T) {
|
||||
scratch := newScratch()
|
||||
nothing := scratch.GetSortedMapValues("nothing")
|
||||
if nothing != nil {
|
||||
t.Errorf("Should not return anything, but got %v", nothing)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user