From: bep Date: Tue, 20 Jan 2015 16:15:12 +0000 (+0100) Subject: Add tests for IsSet X-Git-Tag: v0.13~147 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1b91fec0;p=brevno-suite%2Fhugo Add tests for IsSet --- diff --git a/tpl/template_test.go b/tpl/template_test.go index 2dcf0b12..8b5f4617 100644 --- a/tpl/template_test.go +++ b/tpl/template_test.go @@ -361,6 +361,16 @@ func TestIntersect(t *testing.T) { } } +func TestIsSet(t *testing.T) { + aSlice := []interface{}{1, 2, 3, 5} + aMap := map[string]interface{}{"a": 1, "b": 2} + + assert.True(t, IsSet(aSlice, 2)) + assert.True(t, IsSet(aMap, "b")) + assert.False(t, IsSet(aSlice, 22)) + assert.False(t, IsSet(aMap, "bc")) +} + func (x *TstX) TstRp() string { return "r" + x.A }