mirror of
https://github.com/beego/bee.git
synced 2025-07-05 23:30:18 +00:00
fixed tests code cannot convert ".." to type rune
修正在使用bee生成的测试用例代码时,文件路径没有转换为字符串导致报错的问题
This commit is contained in:
14
apiapp.go
14
apiapp.go
@ -40,11 +40,11 @@ In the appname folder has the follow struct:
|
||||
├── routers
|
||||
│ └── router.go
|
||||
├── tests
|
||||
│ └── default_test.go
|
||||
│ └── default_test.go
|
||||
├── main.go
|
||||
└── models
|
||||
└── object.go
|
||||
└── user.go
|
||||
└── object.go
|
||||
└── user.go
|
||||
|
||||
`,
|
||||
}
|
||||
@ -471,14 +471,14 @@ import (
|
||||
"runtime"
|
||||
"path/filepath"
|
||||
_ "{{.Appname}}/routers"
|
||||
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, file, _, _ := runtime.Caller(1)
|
||||
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + filepath.Separator)))
|
||||
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator))))
|
||||
beego.TestBeegoInit(apppath)
|
||||
}
|
||||
|
||||
@ -487,9 +487,9 @@ func TestGet(t *testing.T) {
|
||||
r, _ := http.NewRequest("GET", "/object", nil)
|
||||
w := httptest.NewRecorder()
|
||||
beego.BeeApp.Handlers.ServeHTTP(w, r)
|
||||
|
||||
|
||||
beego.Trace("testing", "TestGet", "Code[%d]\n%s", w.Code, w.Body.String())
|
||||
|
||||
|
||||
Convey("Subject: Test Station Endpoint\n", t, func() {
|
||||
Convey("Status Code Should Be 200", func() {
|
||||
So(w.Code, ShouldEqual, 200)
|
||||
|
Reference in New Issue
Block a user