[go-nuts] Re: testing examples printing to stdout not working for global var

2022-05-02 Thread psi....@gmail.com
#1 the two functions need to behave identically according to the syntax of 
the language.

#2 this is how working code operates, so testing needs to be able to handle 
it.

at a guess; 'testing' would appear to have some non-compliant reflection 
going on, in this edge-case.

but anyway; your reply has no relevance i can decern, and replying like 
this can put off useful comments. please don't get huffy i don't have the 
time/interest, just don't comment anymore.

On Monday, 2 May 2022 at 03:32:46 UTC+1 peterGo wrote:

> It looks like you have a bug in your code.
>
> "In tests, standard output is accumulated during execution and dumped to 
> standard output when done."
>
> "Example functions may include a concluding line comment that begins with 
> "Output:" and is compared with the standard output of the function when the 
> tests are run."
>
> In ExampleMain(), you improperly used the os.Stdout variable value as of 
> the testing package initialization. 
>
> In ExampleMain2(), you properly used the os.Stdout variable value as of 
> when the function was run.
>
> testing package   
> https://pkg.go.dev/testing@latest
>
> Peter
>
> On Sunday, May 1, 2022 at 8:03:29 PM UTC-4 psi@gmail.com wrote:
>
>> this caught me out, is it a bug?
>>
>> https://go.dev/play/p/atJb8dZHoqi
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d8654a21-e060-4bee-842f-e6eb41d21878n%40googlegroups.com.


[go-nuts] testing examples printing to stdout not working for global var

2022-05-01 Thread psi....@gmail.com
this caught me out, is it a bug?

https://go.dev/play/p/atJb8dZHoqi

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/510e3127-69bc-43cf-8887-2bc8dc7ff6cdn%40googlegroups.com.