aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Kisiel <kamil@kamilkisiel.net>2015-06-06 01:53:49 +0300
committerKamil Kisiel <kamil@kamilkisiel.net>2015-06-06 01:53:49 +0300
commit68004d2ba3cbc80d3a9949ea431b5c9f22ee8707 (patch)
tree70f025190e221c4a0b06992ad49b1a20a78bd0a3
parent203fca9e226add43f54aa91a8b7c2836a52803ce (diff)
parent6dca1ffb59c049519465f7d59c811cd190c124ec (diff)
Merge pull request #22 from cyx/use-reflect-deepequal
Use reflect.DeepEqual instead
-rw-r--r--securecookie_test.go16
1 files changed, 2 insertions, 14 deletions
diff --git a/securecookie_test.go b/securecookie_test.go
index 76368a9..e482397 100644
--- a/securecookie_test.go
+++ b/securecookie_test.go
@@ -9,8 +9,8 @@ import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
- "errors"
"fmt"
+ "reflect"
"strings"
"testing"
)
@@ -24,18 +24,6 @@ var testStrings = []string{"foo", "bar", "baz"}
func TestSecureCookie(t *testing.T) {
// TODO test too old / too new timestamps
- compareMaps := func(m1, m2 map[string]interface{}) error {
- if len(m1) != len(m2) {
- return errors.New("different maps")
- }
- for k, v := range m1 {
- if m2[k] != v {
- return fmt.Errorf("Different value for key %v: expected %v, got %v", k, m2[k], v)
- }
- }
- return nil
- }
-
s1 := New([]byte("12345"), []byte("1234567890123456"))
s2 := New([]byte("54321"), []byte("6543210987654321"))
value := map[string]interface{}{
@@ -56,7 +44,7 @@ func TestSecureCookie(t *testing.T) {
if err2 != nil {
t.Fatalf("%v: %v", err2, encoded)
}
- if err := compareMaps(dst, value); err != nil {
+ if !reflect.DeepEqual(dst, value) {
t.Fatalf("Expected %v, got %v.", value, dst)
}
dst2 := make(map[string]interface{})