1
0
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:
Marek Janda
2015-08-02 07:00:43 +02:00
committed by Bjørn Erik Pedersen
parent 8d28686edc
commit 4bed69629e
3 changed files with 66 additions and 2 deletions

View File

@@ -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)
}
}