On Tuesday, November 19, 2019 at 4:11:52 PM UTC+11, burak serdar wrote:
>
>
>
> This is what I usually do in these situations:
>
> var amqpDial=amqp.Dial
> func (mq *MQ) Connect() (err error) {
> ...
> mq.conn, err = amqpDial(mq.URI)
> ...
> }
>
> func TestConnect(t *testing.T) {
> amqpDial=fakeDial
> defer func() {amqpDial=amqp.Dial}()
> ...
> }
>
>
> This works, the only drawback is that I have to choose between making
amqpDial an exported (I want to say symbol here) variable, or have the test
in the same package (as opposed to a _test pkg)
I've gone with the latter, put these tests into the same package, thanks.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/d6a6e01c-00df-47f7-94ac-a37e00cb73d7%40googlegroups.com.