franela / goblin

Minimal and Beautiful Go testing framework
MIT License
887 stars 79 forks source link

Regexp test selector does not seem to work. #74

Closed snobb closed 4 years ago

snobb commented 6 years ago

I cannot see the regexp flag -goblin.run working unless I comment out the flag.Parsed() check in the Goblin constructor. In my tests it seems to always be true even though I do not see where else the flag.Parse() is called.

func Goblin(t *testing.T, arguments ...string) *G {
    // if !flag.Parsed() {
    parseFlags()
    // }

Removing the check seems to work well though.

The command I run is as follows:

$ go test ./pkg/... -v -goblin.run="regexp"

OR

$ go test ./pkg/... -v -args -goblin.run="regexp"

EDIT: I am using go1.11

marcosnils commented 6 years ago

Interesting. Maybe something changed in the latest versions of Go which changed this behavior. It's also strange that you changed the code and tests are still passing. I'll check it out in the weekend.

snobb commented 6 years ago

Any update on this? Thanks.

ahmedhosnycs commented 4 years ago

I've migrated from go1.9 to go1.13 and since then I've the same issue. Would appreciate any input or workaround regarding this issue

sockol commented 4 years ago

This ^ fixed the issue for me, but lmk if you think there's a better solution @marcosnils