Skip to content

Commit

Permalink
fixes bug when there is more than one context registered, closes #32
Browse files Browse the repository at this point in the history
  • Loading branch information
l3pp4rd committed May 27, 2016
1 parent 518101c commit f9fab51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 3 additions & 1 deletion builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}`))
Expand Down
4 changes: 2 additions & 2 deletions cmd/godog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions suite_test.go
Original file line number Diff line number Diff line change
@@ -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{}

Expand Down

0 comments on commit f9fab51

Please sign in to comment.