Re: [go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-30 Thread Ian Davis
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

[go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-30 Thread Jérôme LAFORGE
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

[go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-30 Thread Jordan Krage
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: >

[go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-29 Thread Jérôme LAFORGE
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

[go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-27 Thread Jérôme LAFORGE
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