Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
94bde3a7
Commit
94bde3a7
authored
Mar 25, 2016
by
JessonChan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change to logs
parent
52a0b657
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
11 deletions
+6
-11
filter_test.go
filter_test.go
+0
-6
router_test.go
router_test.go
+6
-5
No files found.
filter_test.go
View file @
94bde3a7
...
...
@@ -20,14 +20,8 @@ import (
"testing"
"github.com/astaxie/beego/context"
"github.com/astaxie/beego/logs"
)
func
init
()
{
BeeLogger
=
logs
.
NewLogger
(
10000
)
BeeLogger
.
SetLogger
(
"console"
,
""
)
}
var
FilterUser
=
func
(
ctx
*
context
.
Context
)
{
ctx
.
Output
.
Body
([]
byte
(
"i am "
+
ctx
.
Input
.
Param
(
":last"
)
+
ctx
.
Input
.
Param
(
":first"
)))
}
...
...
router_test.go
View file @
94bde3a7
...
...
@@ -21,6 +21,7 @@ import (
"testing"
"github.com/astaxie/beego/context"
"github.com/astaxie/beego/logs"
)
type
TestController
struct
{
...
...
@@ -94,7 +95,7 @@ func TestUrlFor(t *testing.T) {
handler
.
Add
(
"/api/list"
,
&
TestController
{},
"*:List"
)
handler
.
Add
(
"/person/:last/:first"
,
&
TestController
{},
"*:Param"
)
if
a
:=
handler
.
URLFor
(
"TestController.List"
);
a
!=
"/api/list"
{
Info
(
a
)
logs
.
Info
(
a
)
t
.
Errorf
(
"TestController.List must equal to /api/list"
)
}
if
a
:=
handler
.
URLFor
(
"TestController.Param"
,
":last"
,
"xie"
,
":first"
,
"asta"
);
a
!=
"/person/xie/asta"
{
...
...
@@ -120,24 +121,24 @@ func TestUrlFor2(t *testing.T) {
handler
.
Add
(
"/v1/:v(.+)_cms/ttt_:id(.+)_:page(.+).html"
,
&
TestController
{},
"*:Param"
)
handler
.
Add
(
"/:year:int/:month:int/:title/:entid"
,
&
TestController
{})
if
handler
.
URLFor
(
"TestController.GetURL"
,
":username"
,
"astaxie"
)
!=
"/v1/astaxie/edit"
{
Info
(
handler
.
URLFor
(
"TestController.GetURL"
))
logs
.
Info
(
handler
.
URLFor
(
"TestController.GetURL"
))
t
.
Errorf
(
"TestController.List must equal to /v1/astaxie/edit"
)
}
if
handler
.
URLFor
(
"TestController.List"
,
":v"
,
"za"
,
":id"
,
"12"
,
":page"
,
"123"
)
!=
"/v1/za/cms_12_123.html"
{
Info
(
handler
.
URLFor
(
"TestController.List"
))
logs
.
Info
(
handler
.
URLFor
(
"TestController.List"
))
t
.
Errorf
(
"TestController.List must equal to /v1/za/cms_12_123.html"
)
}
if
handler
.
URLFor
(
"TestController.Param"
,
":v"
,
"za"
,
":id"
,
"12"
,
":page"
,
"123"
)
!=
"/v1/za_cms/ttt_12_123.html"
{
Info
(
handler
.
URLFor
(
"TestController.Param"
))
logs
.
Info
(
handler
.
URLFor
(
"TestController.Param"
))
t
.
Errorf
(
"TestController.List must equal to /v1/za_cms/ttt_12_123.html"
)
}
if
handler
.
URLFor
(
"TestController.Get"
,
":year"
,
"1111"
,
":month"
,
"11"
,
":title"
,
"aaaa"
,
":entid"
,
"aaaa"
)
!=
"/1111/11/aaaa/aaaa"
{
Info
(
handler
.
URLFor
(
"TestController.Get"
))
logs
.
Info
(
handler
.
URLFor
(
"TestController.Get"
))
t
.
Errorf
(
"TestController.Get must equal to /1111/11/aaaa/aaaa"
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment