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
b9fdd675
authored
2014-11-04 16:39:17 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add test case fot date & stringbool
1 parent
7743eecf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
templatefunc_test.go
templatefunc_test.go
View file @
b9fdd67
...
...
@@ -108,6 +108,8 @@ func TestParseForm(t *testing.T) {
Age
int
`form:"age,text"`
Email
string
Intro
string
`form:",textarea"`
StrBool
bool
`form:"strbool"`
Date
time
.
Time
`form:"date,2006-01-02"`
}
u
:=
user
{}
...
...
@@ -119,6 +121,8 @@ func TestParseForm(t *testing.T) {
"age"
:
[]
string
{
"40"
},
"Email"
:
[]
string
{
"test@gmail.com"
},
"Intro"
:
[]
string
{
"I am an engineer!"
},
"strbool"
:
[]
string
{
"yes"
},
"date"
:
[]
string
{
"2014-11-12"
},
}
if
err
:=
ParseForm
(
form
,
u
);
err
==
nil
{
t
.
Fatal
(
"nothing will be changed"
)
...
...
@@ -144,6 +148,13 @@ func TestParseForm(t *testing.T) {
if
u
.
Intro
!=
"I am an engineer!"
{
t
.
Errorf
(
"Intro should equal `I am an engineer!` but got `%v`"
,
u
.
Intro
)
}
if
u
.
StrBool
!=
true
{
t
.
Errorf
(
"strboll should equal `true`, but got `%v`"
,
u
.
StrBool
)
}
y
,
m
,
d
:=
u
.
Date
.
Date
()
if
y
!=
2014
||
m
.
String
()
!=
"November"
||
d
!=
12
{
t
.
Errorf
(
"Date should equal `2014-11-12`, but got `%v`"
,
u
.
Date
.
String
())
}
}
func
TestRenderForm
(
t
*
testing
.
T
)
{
...
...
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