fixes bug when there is more than one context registered, closes #32

Этот коммит содержится в:
gedi 2016-05-27 14:55:58 +03:00
родитель 518101cbc7
коммит f9fab51a1a
3 изменённых файлов: 5 добавлений и 11 удалений

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

@ -23,7 +23,9 @@ const GodogSuiteName = "{{ .Name }}"
func TestMain(m *testing.M) {
status := {{ if ne .Name "godog" }}godog.{{ end }}Run(func (suite *{{ if ne .Name "godog" }}godog.{{ end }}Suite) {
{{range .Contexts}}{{ . }}(suite){{end}}
{{range .Contexts}}
{{ . }}(suite)
{{end}}
})
os.Exit(status)
}`))

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

@ -41,7 +41,7 @@ func buildAndRun() (int, error) {
cmdb.Dir = dir
cmdb.Env = os.Environ()
if details, err := cmdb.CombinedOutput(); err != nil {
fmt.Println(string(details))
fmt.Fprintln(stderr, string(details))
return 1, err
}
defer os.Remove(bin)
@ -77,7 +77,7 @@ func buildAndRun() (int, error) {
func main() {
status, err := buildAndRun()
if err != nil {
fmt.Println(err)
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
// it might be a case, that status might not be resolved

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

@ -1,21 +1,13 @@
package godog
import (
"flag"
"fmt"
"os"
"strconv"
"strings"
"testing"
"github.com/DATA-DOG/godog/gherkin"
)
func TestMain(m *testing.M) {
flag.Parse()
os.Exit(m.Run())
}
func SuiteContext(s *Suite) {
c := &suiteContext{}