diff options
author | moraes <rodrigo.moraes@gmail.com> | 2012-10-13 11:34:19 +0400 |
---|---|---|
committer | moraes <rodrigo.moraes@gmail.com> | 2012-10-13 11:34:19 +0400 |
commit | aaee2300ed56f2b0fa93ec1fb3510fa9f86b3e57 (patch) | |
tree | 7adf0441a0381fd00854a34e11f3e030eb31d8f5 /securecookie_test.go | |
parent | f34e8230f6655498a5e469bd42f6cf2f2b87ad5d (diff) |
Better errors for EncodeMulti and DecodeMulti. Closes #1.
Diffstat (limited to 'securecookie_test.go')
-rw-r--r-- | securecookie_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/securecookie_test.go b/securecookie_test.go index 0187ba0..099c290 100644 --- a/securecookie_test.go +++ b/securecookie_test.go @@ -10,6 +10,7 @@ import ( "crypto/sha256" "errors" "fmt" + "strings" "testing" ) @@ -131,6 +132,18 @@ func TestEncoding(t *testing.T) { } } +func TestMultiError(t *testing.T) { + s1, s2 := New(nil, nil), New(nil, nil) + _, err := EncodeMulti("sid", "value", s1, s2) + if len(err.(MultiError)) != 2 { + t.Errorf("Expected 2 errors, got %s.", err) + } else { + if strings.Index(err.Error(), "hash key is not set") == -1 { + t.Errorf("Expected missing hash key error, got %s.", err.Error()) + } + } +} + // ---------------------------------------------------------------------------- type FooBar struct { |