mirror of
https://github.com/astaxie/beego.git
synced 2024-11-10 20:30:54 +00:00
29 lines
441 B
Go
29 lines
441 B
Go
package session
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func Test_gob(t *testing.T) {
|
|
a := make(map[interface{}]interface{})
|
|
a["username"] = "astaxie"
|
|
a[12] = 234
|
|
b, err := encodeGob(a)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
c, err := decodeGob(b)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
if len(c) == 0 {
|
|
t.Error("decodeGob empty")
|
|
}
|
|
if c["username"] != "astaxie" {
|
|
t.Error("decode string error")
|
|
}
|
|
if c[12] != 234 {
|
|
t.Error("decode int error")
|
|
}
|
|
}
|