add session test & delete readme
Showing
2 changed files
with
28 additions
and
1 deletions
session/sess_test.go
0 → 100644
| 1 | package session | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "testing" | ||
| 5 | ) | ||
| 6 | |||
| 7 | func Test_gob(t *testing.T) { | ||
| 8 | a := make(map[interface{}]interface{}) | ||
| 9 | a["username"] = "astaxie" | ||
| 10 | a[12] = 234 | ||
| 11 | b, err := encodeGob(a) | ||
| 12 | if err != nil { | ||
| 13 | t.Error(err) | ||
| 14 | } | ||
| 15 | c, err := decodeGob(b) | ||
| 16 | if err != nil { | ||
| 17 | t.Error(err) | ||
| 18 | } | ||
| 19 | if len(c) == 0 { | ||
| 20 | t.Error("decodeGob empty") | ||
| 21 | } | ||
| 22 | if c["username"] != "astaxie" { | ||
| 23 | t.Error("decode string error") | ||
| 24 | } | ||
| 25 | if c[12] != 234 { | ||
| 26 | t.Error("decode int error") | ||
| 27 | } | ||
| 28 | } |
-
Please register or sign in to post a comment