1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 14:30:50 +00:00

add more json test info

This commit is contained in:
astaxie 2013-11-11 21:25:03 +08:00
parent 2f75445520
commit ac6108a87d

View File

@ -12,7 +12,14 @@ var jsoncontext = `{
"PI": 3.1415976,
"runmode": "dev",
"autorender": false,
"copyrequestbody": true
"copyrequestbody": true,
"database": {
"host": "host",
"port": "port",
"database": "database",
"username": "username",
"password": "password"
}
}`
func TestJson(t *testing.T) {
@ -63,4 +70,13 @@ func TestJson(t *testing.T) {
if jsonconf.String("name") != "astaxie" {
t.Fatal("get name error")
}
if db, err := jsonconf.DIY("database"); err != nil {
t.Fatal(err)
} else if m, ok := db.(map[string]interface{}); !ok {
t.Fatal("db not map[string]interface{}")
} else {
if m["host"].(string) != "host" {
t.Fatal("get host err")
}
}
}