Define a logging interface in your main package, then pass an
implementation of the interface in your test that forwards writes to
t.Logf
On Tue, 30 Jan 2018, at 2:11 PM, Jérôme LAFORGE wrote:
> No, it is not possible to use t.Log within the code you want to test.> The
> function IsBuggyEven is n
No, it is not possible to use t.Log within the code you want to test.
The function IsBuggyEven is not defined to be used into testing scope, it
is defined to be used into production context.
Le mardi 30 janvier 2018 13:48:27 UTC+1, Jordan Krage a écrit :
>
> Try using `t.Logf` instead of `fmt.Pri
Try using `t.Logf` instead of `fmt.Printf`.
On Saturday, January 27, 2018 at 6:03:13 AM UTC-6, Jérôme LAFORGE wrote:
>
> Of course, that was I already did. But I talk about the log into function
> I want to test (in the example of playground: func IsBuggyEven) .
> see:
> https://play.golang.org
Is it worth opening an issue?
--
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.goo
Of course, that was I already did. But I talk about the log into function I
want to test (in the example of playground: func IsBuggyEven) .
see:
https://play.golang.org/p/OWnEntLwfXa
check 0 is even or odd, but I want see this log only for fail test case
(i.e when i == 5)
check 2 is even or o