From c223d6df5316d3dc8d651d7762ba32dd867d9f69 Mon Sep 17 00:00:00 2001 From: Kamil Kisiel Date: Thu, 6 Aug 2015 11:04:18 -0700 Subject: add test for nil hash key --- securecookie_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'securecookie_test.go') diff --git a/securecookie_test.go b/securecookie_test.go index 1d7f640..33ce4fc 100644 --- a/securecookie_test.go +++ b/securecookie_test.go @@ -74,6 +74,18 @@ func TestSecureCookie(t *testing.T) { } } +func TestSecureCookieNilKey(t *testing.T) { + s1 := New(nil, nil) + value := map[string]interface{}{ + "foo": "bar", + "baz": 128, + } + _, err := s1.Encode("sid", value) + if err != errHashKeyNotSet { + t.Fatal("Wrong error returned:", err) + } +} + func TestDecodeInvalid(t *testing.T) { // List of invalid cookies, which must not be accepted, base64-decoded // (they will be encoded before passing to Decode). -- cgit v1.2.3