Make suite private
Этот коммит содержится в:
родитель
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")
|
||||
|
|
12
suite.go
12
suite.go
|
@ -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))
|
||||
}
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче