mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 03:20:57 +00:00
add more json test info
This commit is contained in:
parent
2f75445520
commit
ac6108a87d
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user