mirror of
https://github.com/beego/bee.git
synced 2024-11-24 23:30:55 +00:00
improve the bee
This commit is contained in:
parent
7da30d1b35
commit
3141202051
@ -214,6 +214,12 @@ import (
|
|||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
_, file, _, _ := runtime.Caller(1)
|
||||||
|
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, "../")))
|
||||||
|
beego.TestBeegoInit(apppath)
|
||||||
|
}
|
||||||
|
|
||||||
// TestGet is a sample to run an endpoint test
|
// TestGet is a sample to run an endpoint test
|
||||||
func TestGet(t *testing.T) {
|
func TestGet(t *testing.T) {
|
||||||
r, _ := http.NewRequest("GET", "/object", nil)
|
r, _ := http.NewRequest("GET", "/object", nil)
|
||||||
|
7
new.go
7
new.go
@ -182,6 +182,13 @@ import (
|
|||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
_, file, _, _ := runtime.Caller(1)
|
||||||
|
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, "../")))
|
||||||
|
beego.TestBeegoInit(apppath)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TestMain is a sample to run an endpoint test
|
// TestMain is a sample to run an endpoint test
|
||||||
func TestMain(t *testing.T) {
|
func TestMain(t *testing.T) {
|
||||||
r, _ := http.NewRequest("GET", "/", nil)
|
r, _ := http.NewRequest("GET", "/", nil)
|
||||||
|
11
test.go
11
test.go
@ -63,23 +63,14 @@ func testApp(cmd *Command, args []string) {
|
|||||||
ColorLog("[ERRO] Fail to parse bee.json[ %s ]\n", err)
|
ColorLog("[ERRO] Fail to parse bee.json[ %s ]\n", err)
|
||||||
}
|
}
|
||||||
var paths []string
|
var paths []string
|
||||||
paths = safePathAppend(paths,
|
readAppDirectories(crupath, &paths)
|
||||||
path.Join(crupath, conf.DirStruct.Controllers),
|
|
||||||
path.Join(crupath, conf.DirStruct.Models),
|
|
||||||
path.Join(crupath, "./")) // Current path.
|
|
||||||
// Because monitor files has some issues, we watch current directory
|
|
||||||
// and ignore non-go files.
|
|
||||||
paths = append(paths, conf.DirStruct.Others...)
|
|
||||||
|
|
||||||
NewWatcher(paths, nil)
|
NewWatcher(paths, nil)
|
||||||
appname = args[0]
|
appname = args[0]
|
||||||
Autobuild(nil)
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-started:
|
case <-started:
|
||||||
runTest()
|
runTest()
|
||||||
//Kill()
|
|
||||||
//os.Exit(0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user