Этот коммит содержится в:
Algirdas Matas 2015-06-12 16:56:55 +03:00
родитель 412465f947
коммит 1eac4376b2
3 изменённых файлов: 10 добавлений и 14 удалений

Просмотреть файл

@ -21,9 +21,7 @@ import (
)
func main() {
suite := &GodogSuite{
steps: make(map[*regexp.Regexp]StepHandler),
}
suite := godog.New()
{{range $c := .Contexts}}
{{$c}}(suite)
{{end}}

Просмотреть файл

@ -5,14 +5,6 @@ import (
"regexp"
)
//func init() {
//f := StepHandlerFunc(func(args ...interface{}) error {
//log.Println("step triggered")
//return nil
//})
//Step(regexp.MustCompile("hello"), f)
//}
func SomeContext(g Suite) {
f := StepHandlerFunc(func(args ...interface{}) error {
log.Println("step triggered")

Просмотреть файл

@ -9,14 +9,20 @@ type Suite interface {
Step(exp *regexp.Regexp, h StepHandler)
}
type GodogSuite struct {
type suite struct {
steps map[*regexp.Regexp]StepHandler
}
func (s *GodogSuite) Step(exp *regexp.Regexp, h StepHandler) {
func New() *suite {
return &suite{
steps: make(map[*regexp.Regexp]StepHandler),
}
}
func (s *suite) Step(exp *regexp.Regexp, h StepHandler) {
s.steps[exp] = h
}
func (s *GodogSuite) Run() {
func (s *suite) Run() {
log.Println("running godoc, num registered steps:", len(s.steps))
}