mirror of
https://github.com/gin-gonic/gin.git
synced 2026-01-10 08:27:00 +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 == "" {
|
if timeFormat == "" {
|
||||||
return errors.New("Blank time format")
|
return errors.New("Blank time format")
|
||||||
}
|
}
|
||||||
|
|
||||||
if val == "" {
|
if val == "" {
|
||||||
value.Set(reflect.ValueOf(time.Time{}))
|
value.Set(reflect.ValueOf(time.Time{}))
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -87,7 +87,7 @@ func (c *Context) HandlerName() string {
|
|||||||
|
|
||||||
// Handler returns the main handler.
|
// Handler returns the main handler.
|
||||||
func (c *Context) Handler() HandlerFunc {
|
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) {
|
func TestContextHandler(t *testing.T) {
|
||||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||||
c.handlers = HandlersChain{func(c *Context) {}, handlerTest}
|
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) {
|
func TestContextQuery(t *testing.T) {
|
||||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||||
c.Request, _ = http.NewRequest("GET", "http://example.com/?foo=bar&page=10&id=", nil)
|
c.Request, _ = http.NewRequest("GET", "http://example.com/?foo=bar&page=10&id=", nil)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user