Commit ac6108a8 authored by astaxie's avatar astaxie

add more json test info

parent 2f754455
......@@ -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")
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment