|
@@ -12,6 +12,7 @@ import (
|
|
|
"mime/multipart"
|
|
"mime/multipart"
|
|
|
"net/http"
|
|
"net/http"
|
|
|
"net/http/httptest"
|
|
"net/http/httptest"
|
|
|
|
|
+ "reflect"
|
|
|
"strings"
|
|
"strings"
|
|
|
"testing"
|
|
"testing"
|
|
|
"time"
|
|
"time"
|
|
@@ -277,6 +278,18 @@ func handlerNameTest(c *Context) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+var handlerTest HandlerFunc = func(c *Context) {
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func TestContextHandler(t *testing.T) {
|
|
|
|
|
+ c, _ := CreateTestContext(httptest.NewRecorder())
|
|
|
|
|
+ c.handlers = HandlersChain{func(c *Context) {}, handlerTest}
|
|
|
|
|
+
|
|
|
|
|
+ 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)
|