适用于 Go 的 Pragmatic BDD 测试框架
Pragmatic BDD Testing Framework For Go.
import "math"
Desc("math.Abs", func(it It) {
it("returns the absolute value of x", func(expect Expect) {
expect(math.Abs(-12)).Equal(12.0)
expect(math.Abs(-.5)).Equal(0.5)
})
})Why Māo?
Update: Development Status
Install the Go library first;
$ go install github.com/azer/maoAnd optionally, install the command-line tool to avoid the boilerplate code: See examples/simple-with-boilerplate.go if you'd like to skip this step
$ curl https://raw.github.com/azer/mao/master/install | shCreate a test module anywhere you want and import the code you'd like to test:
import "math/rand" // or: import "github.com/you/repository"
Desc("math.Abs", func(it It) {
it("returns the absolute value of x", func(expect Expect) {
expect(math.Abs(-12)).Equal(12.0)
expect(math.Abs(-.5)).Equal(0.5)
})
})And run it with mao command:
$ mao test.goIt'll either output a simple success message that will look like;
Ran 3 tests successfully.Or some error messages with failing source code lines, like following;
I recently think of two major changes in the project;
So it'd be looking like;
import "math"
Test("returns the absolute value of x", func(e Expect) {
expect(math.Abs(-12)).Equal(12.0)
expect(math.Abs(-.5)).Equal(0.5)
})At this point, I wouldn't recommend to use Mao. I still have the same goal but it may cause some pain since its preprocesser is not reliable enough.
And since other projects occupy my time nowadays, I'd appreciate pull requests to reach the goals of the project. Thanks for your interest!
暂无开放 Issues,或尚未同步最近议题。