Make suite private
Этот коммит содержится в:
родитель
412465f947
коммит
1eac4376b2
3 изменённых файлов: 10 добавлений и 14 удалений
|
@ -21,9 +21,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
suite := &GodogSuite{
|
suite := godog.New()
|
||||||
steps: make(map[*regexp.Regexp]StepHandler),
|
|
||||||
}
|
|
||||||
{{range $c := .Contexts}}
|
{{range $c := .Contexts}}
|
||||||
{{$c}}(suite)
|
{{$c}}(suite)
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -5,14 +5,6 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
)
|
)
|
||||||
|
|
||||||
//func init() {
|
|
||||||
//f := StepHandlerFunc(func(args ...interface{}) error {
|
|
||||||
//log.Println("step triggered")
|
|
||||||
//return nil
|
|
||||||
//})
|
|
||||||
//Step(regexp.MustCompile("hello"), f)
|
|
||||||
//}
|
|
||||||
|
|
||||||
func SomeContext(g Suite) {
|
func SomeContext(g Suite) {
|
||||||
f := StepHandlerFunc(func(args ...interface{}) error {
|
f := StepHandlerFunc(func(args ...interface{}) error {
|
||||||
log.Println("step triggered")
|
log.Println("step triggered")
|
||||||
|
|
12
suite.go
12
suite.go
|
@ -9,14 +9,20 @@ type Suite interface {
|
||||||
Step(exp *regexp.Regexp, h StepHandler)
|
Step(exp *regexp.Regexp, h StepHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
type GodogSuite struct {
|
type suite struct {
|
||||||
steps map[*regexp.Regexp]StepHandler
|
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
|
s.steps[exp] = h
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GodogSuite) Run() {
|
func (s *suite) Run() {
|
||||||
log.Println("running godoc, num registered steps:", len(s.steps))
|
log.Println("running godoc, num registered steps:", len(s.steps))
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче