mirror of
https://github.com/gin-gonic/gin.git
synced 2026-01-07 23:03:11 +08:00
gofmt code
This commit is contained in:
parent
53799774f4
commit
d425bf52b6
@ -152,7 +152,7 @@ func setTimeField(val string, structField reflect.StructField, value reflect.Val
|
||||
if timeFormat == "" {
|
||||
return errors.New("Blank time format")
|
||||
}
|
||||
|
||||
|
||||
if val == "" {
|
||||
value.Set(reflect.ValueOf(time.Time{}))
|
||||
return nil
|
||||
|
||||
@ -87,7 +87,7 @@ func (c *Context) HandlerName() string {
|
||||
|
||||
// Handler returns the main handler.
|
||||
func (c *Context) Handler() HandlerFunc {
|
||||
return c.handlers.Last()
|
||||
return c.handlers.Last()
|
||||
}
|
||||
|
||||
/************************************/
|
||||
|
||||
@ -283,13 +283,12 @@ var handlerTest HandlerFunc = func(c *Context) {
|
||||
}
|
||||
|
||||
func TestContextHandler(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
c.handlers = HandlersChain{func(c *Context) {}, handlerTest}
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
c.handlers = HandlersChain{func(c *Context) {}, handlerTest}
|
||||
|
||||
assert.Equal(t, reflect.ValueOf(handlerTest).Pointer(), reflect.ValueOf(c.Handler()).Pointer())
|
||||
assert.Equal(t, reflect.ValueOf(handlerTest).Pointer(), reflect.ValueOf(c.Handler()).Pointer())
|
||||
}
|
||||
|
||||
|
||||
func TestContextQuery(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
c.Request, _ = http.NewRequest("GET", "http://example.com/?foo=bar&page=10&id=", nil)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user