luontola / gospec

Testing framework for Go. Allows writing self-documenting tests/specifications, and executes them concurrently and safely isolated. [UNMAINTAINED]
Apache License 2.0
113 stars 17 forks source link

Make *testing.T object available from inside spec functions #4

Open rafrombrc opened 11 years ago

rafrombrc commented 11 years ago

I've hit a hiccup trying to use gomock w/ gospec b/c creating a gomock controller requires access to the testing object that go usually passes in to tests. Ideally there'd be a way to get access to the lower level testing object from within the spec functions, possibly as a method call on the context object.

xyzjace commented 10 years ago

+1. I might see if I can hack some code in that allows this and PR it.

jveldridge commented 10 years ago

I'd like this functionality as well. @orfjackal, any plans to merge this in? @rafrombrc, any plans to merge this in your fork?

rafrombrc commented 10 years ago

@jveldridge No, I worked around it. Turned out I was able to appease gomock w/ a simple, fake testing context, see https://github.com/mozilla-services/heka/blob/dev/pipeline/testsupport/support.go#L36.

In other news, I haven't been very happy w/ gomock, wouldn't really recommend it for use.

jveldridge commented 10 years ago

Gotcha. I'm actually using testify (https://github.com/stretchr/testify/) having also been unhappy with gomock, but there's a similar issue. I'm likewise able to work around it, but seemed like this approach would be more elegant.