Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
ac6108a8
authored
2013-11-11 21:25:03 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add more json test info
1 parent
2f754455
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletions
config/json_test.go
config/json_test.go
View file @
ac6108a
...
...
@@ -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"
)
}
}
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment