diff options
Diffstat (limited to 'securecookie_test.go')
-rw-r--r-- | securecookie_test.go | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/securecookie_test.go b/securecookie_test.go index 2b0f8a1..c32ff33 100644 --- a/securecookie_test.go +++ b/securecookie_test.go @@ -268,15 +268,22 @@ func TestMultiNoCodecs(t *testing.T) { } func TestMissingKey(t *testing.T) { - s1 := New(nil, nil) - - var dst []byte - err := s1.Decode("sid", "value", &dst) - if err != errHashKeyNotSet { - t.Fatalf("Expected %#v, got %#v", errHashKeyNotSet, err) + emptyKeys := [][]byte{ + nil, + []byte(""), } - if err2, ok := err.(Error); !ok || !err2.IsUsage() { - t.Errorf("Expected missing hash key to be IsUsage(); was %#v", err) + + for _, key := range emptyKeys { + s1 := New(key, nil) + + var dst []byte + err := s1.Decode("sid", "value", &dst) + if err != errHashKeyNotSet { + t.Fatalf("Expected %#v, got %#v", errHashKeyNotSet, err) + } + if err2, ok := err.(Error); !ok || !err2.IsUsage() { + t.Errorf("Expected missing hash key to be IsUsage(); was %#v", err) + } } } |